結果

問題 No.24 数当てゲーム
ユーザー cwwcww
提出日時 2016-09-05 17:37:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 959 bytes
コンパイル時間 1,512 ms
コンパイル使用メモリ 171,568 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-09 22:21:56
合計ジャッジ時間 2,180 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
	int N{};
	cin >> N;
	
	vector<int> a(N), b(N), c(N), d(N);
	vector<string> R(N);
	REP( i, N ) cin >> a[i] >> b[i] >> c[i] >> d[i] >> R[i];

	vector<pair<int, int>> P{ {0,0},{1,0},{2,0},{3,0},{4,0},{5,0},{6,0},{7,0},{8,0},{9,0} };
	REP( i, N )
	{
		REP( j, 10 )
		{
			if( R[i] == "YES" )
			{
				if( a[i] == P[j].first || b[i] == P[j].first || c[i] == P[j].first || d[i] == P[j].first )
				{
					P[j].second += 1;
				}
			}
			if( R[i] == "NO" )
			{
				if( a[i] == P[j].first || b[i] == P[j].first || c[i] == P[j].first || d[i] == P[j].first )
				{
					P[j].second = 0;
				}
				else
				{
					P[j].second += 1;
				}
			}
		}
	}
	int tmp{}, res{};
	for( const auto& x : P )
	{
		if( tmp < x.second )
		{
			tmp = x.second;
			res = x.first;
		}
	}
	cout << res << endl;
	return 0;
}
0