結果

問題 No.1716 Bonus Nim
ユーザー milanis48663220milanis48663220
提出日時 2021-10-22 23:40:36
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 317 ms / 2,000 ms
コード長 1,244 bytes
コンパイル時間 1,175 ms
コンパイル使用メモリ 126,308 KB
実行使用メモリ 12,776 KB
最終ジャッジ日時 2023-10-24 15:53:36
合計ジャッジ時間 6,398 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 211 ms
7,356 KB
testcase_05 AC 227 ms
8,608 KB
testcase_06 AC 154 ms
6,780 KB
testcase_07 AC 193 ms
8,104 KB
testcase_08 AC 215 ms
8,080 KB
testcase_09 AC 85 ms
4,728 KB
testcase_10 AC 247 ms
8,208 KB
testcase_11 AC 245 ms
7,496 KB
testcase_12 AC 253 ms
7,600 KB
testcase_13 AC 285 ms
8,756 KB
testcase_14 AC 244 ms
6,352 KB
testcase_15 AC 312 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 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 317 ms
11,396 KB
testcase_23 AC 63 ms
4,348 KB
testcase_24 AC 194 ms
9,012 KB
testcase_25 AC 163 ms
10,820 KB
testcase_26 AC 251 ms
12,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

void solve(){
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    if(n%2 == 1){
        cout << "Alice" << endl;
        return;
    }
    map<int, int> cnt;
    for(int x: a){
        if(cnt.count(x) == 0) cnt[x] = 1;
        else cnt[x]++;
    }
    for(auto [x, c]: cnt){
        if(c%2 == 1) {
            cout << "Alice" << endl;
            return;
        }
    }
    cout << "Bob" << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int t; cin >> t;
    while(t--) solve();
}
0