結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
michonz4
|
| 提出日時 | 2019-05-18 09:56:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,039 bytes |
| 記録 | |
| コンパイル時間 | 644 ms |
| コンパイル使用メモリ | 73,364 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 06:09:26 |
| 合計ジャッジ時間 | 1,178 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 5 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> no{{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}};
map<int, int> yes{{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}};
for (int i=0; i<n; i++) {
int a, b, c, d;
string s;
cin >> a >> b >> c >> d >> s;
if (s=="NO") {
no[a]++;
no[b]++;
no[c]++;
no[d]++;
} else {
yes[a]++;
yes[b]++;
yes[c]++;
yes[d]++;
}
}
map<int, int> mp;
for (auto itr=no.begin(); itr!=no.end(); itr++) {
if (itr->second==0) {
mp[itr->first]++;
}
}
for (auto itr=yes.begin(); itr!=yes.end(); itr++) {
if (itr->second>1) {
mp[itr->first]++;
}
}
int mx=0;
for (auto itr=mp.begin(); itr!=mp.end(); itr++) {
if (itr->second>mx) mx=itr->second;
}
for (auto itr=mp.begin(); itr!=mp.end(); itr++) {
if (itr->second==mx) cout << itr->first << endl;
}
return 0;
}
michonz4