結果

問題 No.1716 Bonus Nim
ユーザー 👑 NachiaNachia
提出日時 2021-10-22 22:45:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 850 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 79,652 KB
実行使用メモリ 5,604 KB
最終ジャッジ日時 2023-10-24 14:08:14
合計ジャッジ時間 3,832 ms
ジャッジサーバーID
(参考情報)
judge15 / 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 92 ms
4,588 KB
testcase_05 AC 95 ms
5,604 KB
testcase_06 AC 84 ms
5,088 KB
testcase_07 AC 88 ms
5,564 KB
testcase_08 AC 94 ms
4,832 KB
testcase_09 AC 66 ms
4,860 KB
testcase_10 AC 99 ms
5,068 KB
testcase_11 AC 98 ms
4,716 KB
testcase_12 AC 100 ms
5,028 KB
testcase_13 AC 102 ms
5,216 KB
testcase_14 AC 99 ms
4,436 KB
testcase_15 AC 45 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 100 ms
4,752 KB
testcase_23 AC 61 ms
4,696 KB
testcase_24 AC 84 ms
4,948 KB
testcase_25 AC 77 ms
4,752 KB
testcase_26 AC 90 ms
4,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)



int main(){
  int T; cin >> T;
  while(T--){
    int N; cin >> N;
    vector<i64> A(N); for(auto& a : A) cin >> a;
    if(N%2 == 1){ cout << "Alice\n"; continue; }
    sort(A.begin(), A.end());
    bool alice_win = true;
    // rep(i,N/2) if(A[i] == A[i+N/2]) alice_win = false;
    bool perfect_pairs = true;
    rep(i,N/2) if(A[i*2] != A[i*2+1]) perfect_pairs = false;
    if(perfect_pairs) alice_win = false;
    if(alice_win) cout << "Alice\n"; else cout << "Bob\n";
  }
  return 0;
}




struct ios_do_not_sync {
    ios_do_not_sync() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
0