結果

問題 No.1716 Bonus Nim
ユーザー se1ka2
提出日時 2021-10-22 22:24:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 784 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 76,752 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-09-23 06:03:27
合計ジャッジ時間 8,854 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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