結果

問題 No.1716 Bonus Nim
ユーザー se1ka2se1ka2
提出日時 2021-10-22 22:24:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 784 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 75,876 KB
実行使用メモリ 12,168 KB
最終ジャッジ日時 2023-10-24 13:41:25
合計ジャッジ時間 8,607 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 342 ms
7,076 KB
testcase_05 WA -
testcase_06 AC 336 ms
7,768 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 340 ms
8,012 KB
testcase_10 AC 346 ms
7,896 KB
testcase_11 AC 346 ms
7,300 KB
testcase_12 AC 354 ms
7,484 KB
testcase_13 AC 373 ms
8,376 KB
testcase_14 WA -
testcase_15 AC 371 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 WA -
testcase_23 AC 399 ms
11,588 KB
testcase_24 AC 398 ms
11,956 KB
testcase_25 AC 415 ms
12,168 KB
testcase_26 AC 390 ms
12,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        map<int, int> mp;
        for(int i = 0; i < n; i++){
            int a;
            cin >> a;
            mp[a]++;
        }
        if(n % 2){
            cout << "Alice" << endl;
            continue;
        }
        int c = 0;
        for(auto itr = mp.begin(); itr != mp.end(); itr++) c += itr->second - 2;
        if(c < 0){
            cout << "Alice" << endl;
            continue;
        }
        int s = 0;
        for(auto itr = mp.begin(); itr != mp.end(); itr++){
            if(itr->second > 1) s += itr->second % 2;
        }
        if(s % 3) cout << "Alice" << endl;
        else cout << "Bob" << endl;
    }
}
0