結果
問題 | No.1852 Divide or Reduce |
ユーザー |
![]() |
提出日時 | 2022-02-27 23:02:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 96 ms / 2,000 ms |
コード長 | 773 bytes |
コンパイル時間 | 270 ms |
コンパイル使用メモリ | 42,240 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 23:27:22 |
合計ジャッジ時間 | 5,437 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 |
ソースコード
/* -*- coding: utf-8 -*- * * 1852.cc: No.1852 Divide or Reduce - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 200000; enum { First, Second }; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N]; /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int n; scanf("%d", &n); ll sum = 0; for (int i = 0; i < n; i++) scanf("%d", as + i), sum += as[i]; int ans; if ((sum - n) & 1) ans = First; else { if (n & 1) ans = Second; else { int mina = *min_element(as, as + n); ans = (mina & 1) ? Second : First; } } if (ans == First) puts("First"); else puts("Second"); } return 0; }