結果

問題 No.1716 Bonus Nim
ユーザー 👑 NachiaNachia
提出日時 2021-10-22 22:40:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 851 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 80,276 KB
実行使用メモリ 5,592 KB
最終ジャッジ日時 2023-10-24 14:00:34
合計ジャッジ時間 3,865 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,576 KB
testcase_05 WA -
testcase_06 AC 82 ms
5,076 KB
testcase_07 AC 86 ms
5,552 KB
testcase_08 AC 92 ms
4,820 KB
testcase_09 AC 66 ms
4,848 KB
testcase_10 AC 97 ms
5,056 KB
testcase_11 AC 96 ms
4,696 KB
testcase_12 AC 98 ms
5,016 KB
testcase_13 AC 99 ms
5,196 KB
testcase_14 AC 96 ms
4,416 KB
testcase_15 WA -
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 97 ms
4,740 KB
testcase_23 AC 62 ms
4,676 KB
testcase_24 AC 83 ms
4,936 KB
testcase_25 AC 77 ms
4,740 KB
testcase_26 AC 88 ms
4,740 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+1) if(A[i] == A[i+N/2-1]) 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