結果

問題 No.24 数当てゲーム
ユーザー wightou
提出日時 2025-05-02 21:46:38
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 831 bytes
コンパイル時間 3,517 ms
コンパイル使用メモリ 276,132 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-02 21:46:43
合計ジャッジ時間 3,697 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

 /////////////////// メイン ///////////////////

int main () {
  
  /////////////////// 前入力 ///////////////////
  
  int q;
  cin >> q;

  /////////////////// 前処理 ///////////////////

  vector<int> counter(10);

  /////////////////// ループ ///////////////////

  for (int loop=0; loop<q; loop++) {
    
    int a, b, c, d;
    string s;
    cin >> a >> b >> c >> d >> s;
    
    if (s=="YES") {
      counter.at(a)++;
      counter.at(b)++;
      counter.at(c)++;
      counter.at(d)++;
    } else {
      counter.at(a)--;
      counter.at(b)--;
      counter.at(c)--;
      counter.at(d)--;
    }
    
  }

  //////////////////// 終了 ////////////////////

  cout << distance(counter.begin(), max_element(counter.begin(),counter.end())) << endl;

  return 0;

}
0