結果

問題 No.24 数当てゲーム
ユーザー sawfish
提出日時 2022-11-12 13:43:24
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 757 bytes
コンパイル時間 2,163 ms
コンパイル使用メモリ 118,912 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 04:52:14
合計ジャッジ時間 2,700 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
using LL = long long;

int nums[10];

int main() {
    int N;
    cin >> N;

    int A, B, C, D;
    string R;
    for (int i = 0; i < N; i++) {
        cin >> A >> B >> C >> D >> R;
        if (R == "NO") {
            nums[A] = -1;
            nums[B] = -1;
            nums[C] = -1;
            nums[D] = -1;
        } else {
            nums[A] += nums[A] != -1 ? 1 : 0;
            nums[B] += nums[B] != -1 ? 1 : 0;
            nums[C] += nums[C] != -1 ? 1 : 0;
            nums[D] += nums[D] != -1 ? 1 : 0;
        }
    }

    int ans = -1, max_ = -1;
    for (int i = 0; i <= 9; i++) {
        if (nums[i] > max_) {
            max_ = nums[i];
            ans = i;
        }
    }
    cout << ans << endl;
}
0