結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  Zu_rin | 
| 提出日時 | 2019-04-01 22:37:18 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 831 bytes | 
| コンパイル時間 | 657 ms | 
| コンパイル使用メモリ | 76,012 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-27 03:31:03 | 
| 合計ジャッジ時間 | 1,103 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void) {
	int num, i = 0, j, k;
	cin >> num;
	string s;
	vector<int> ans(10, 0), qs(5, 16);
	for (; i < num; i++) {
		scanf("%d%d%d%d", &qs[0], &qs[1], &qs[2], &qs[3]);
		cin >> s;
		sort(qs.begin(), qs.end());
		if (s == "YES") {
			for (j = 0, k = 0; j < 10; j++) {
				if (j == qs[k]) {
					k++;
					if (ans[j] == 2)
						continue;
					ans[j] = 1;
				}
				else
					ans[j] = 2;
			}
		}
		else {
			for (j = 0, k = 0; j < 10; j++) {
				if (j == qs[k]) {
					k++;
					if (ans[j] == 2)
						continue;
					ans[j] = 2;
				}
			}
		}
	}
	for (i = 0, k = 10; i < 10; i++) {
		if (ans[i] == 1)
			k = i;
		else if (ans[i] == 0)
			j = i;
	}
	if (k == 10)
		cout << j << "\n";
	else
		cout << k << "\n";
	return 0;
}
            
            
            
        