結果

問題 No.1716 Bonus Nim
ユーザー 👑 NachiaNachia
提出日時 2021-10-22 22:40:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 847 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 79,816 KB
実行使用メモリ 5,560 KB
最終ジャッジ日時 2023-10-24 14:00:44
合計ジャッジ時間 3,772 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,544 KB
testcase_05 AC 96 ms
5,560 KB
testcase_06 AC 83 ms
5,044 KB
testcase_07 AC 88 ms
5,520 KB
testcase_08 AC 94 ms
4,788 KB
testcase_09 AC 66 ms
4,816 KB
testcase_10 AC 99 ms
5,024 KB
testcase_11 AC 99 ms
4,664 KB
testcase_12 AC 100 ms
4,984 KB
testcase_13 AC 101 ms
5,164 KB
testcase_14 AC 95 ms
4,384 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 1 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 98 ms
4,708 KB
testcase_23 AC 61 ms
4,644 KB
testcase_24 AC 83 ms
4,904 KB
testcase_25 AC 77 ms
4,708 KB
testcase_26 AC 90 ms
4,708 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