結果

問題 No.2813 Cookie
ユーザー tnakao0123
提出日時 2024-07-22 17:49:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 659 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 43,392 KB
最終ジャッジ日時 2025-02-23 17:52:13
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |   scanf("%d", &tn);
      |   ~~~~~^~~~~~~~~~~
main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
main.cpp:32:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   32 |     for (int i = 0; i < n; i++) scanf("%d", as + i);
      |                                 ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2813.cc:  No.2813 Cookie - yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

int as[MAX_N];

/* subroutines */

/* main */

int main() {
  int tn;
  scanf("%d", &tn);

  while (tn--) {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", as + i);
    sort(as, as + n);

    bool ok = true;
    for (int i = 0; ok && i < n;) {
      int j = i;
      while (i < n && as[j] == as[i]) i++;
      if ((i - j) & 1) ok = false;
    }

    if (! ok) puts("Alice");
    else puts("Bob");
  }

  return 0;
}
0