結果

問題 No.24 数当てゲーム
ユーザー 遭難者遭難者
提出日時 2022-02-01 22:36:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,164 bytes
コンパイル時間 4,452 ms
コンパイル使用メモリ 204,724 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 02:36:37
合計ジャッジ時間 5,200 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <numeric>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint1000000007;
#define rep(i, n) for (int i = 0; i < n; i++)
#define endl '\n'
#define print(n) cout << (n) << endl
void chmax(ll &a, ll b)
{
    if (a < b)
        a = b;
}
void chmin(ll &a, ll b)
{
    if (a > b)
        a = b;
}
int main()
{
    int n;
    cin >> n;
    vector<vector<int>> a(n);
    rep(i, n)
    {
        vector<int> b(5);
        rep(j, 4) cin >> b[j];
        string t;
        cin >> t;
        b[4] = t[0] == 'N';
        a[i] = b;
    }
    rep(ans, 10)
    {
        bool yes = true;
        for (auto t : a)
        {
            bool to = t[4];
            rep(j, 4) to ^= t[j] == ans;
            yes &= to;
        }
        if (yes)
        {
            print(ans);
            return 0;
        }
    }
    return 1;
}
0