結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  ant2357 | 
| 提出日時 | 2016-06-29 22:54:52 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,155 bytes | 
| コンパイル時間 | 771 ms | 
| コンパイル使用メモリ | 96,216 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-11 23:05:55 | 
| 合計ジャッジ時間 | 1,268 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:60:24: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   60 |         cout << ans << "\n";
      |                        ^~~~
main.cpp:36:16: note: 'ans' was declared here
   36 |         int N, ans;
      |                ^~~
            
            ソースコード
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>
#include <numeric>
#include <sstream>
#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)
#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())
#define LL long long int
#define LD long double
#define PI 3.14159265358979
using namespace std;
//================================================
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, ans;
	cin >> N;
	vector<int>vec(10, 0);
	REP(i, N) {
		string S;
		int A, B, C, D;
		cin >> A >> B >> C >> D >> S;
		if (S == "YES") {
			vec[A]++; vec[B]++; vec[C]++; vec[D]++;
		} else {
			vec[A] = vec[B] = vec[C] = vec[D] = -999;
		}
	}
	int max = *max_element(ALL(vec));
	REP(i, 10) {
		if (max == vec[i]) {
			ans = i;
			break;
		}
	}
	cout << ans << "\n";
	return 0;
}
            
            
            
        