結果

問題 No.24 数当てゲーム
ユーザー michonz4michonz4
提出日時 2019-05-18 09:56:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,039 bytes
コンパイル時間 1,433 ms
コンパイル使用メモリ 73,984 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 07:34:48
合計ジャッジ時間 1,841 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
}
0