結果

問題 No.2044 Infinite Nim
ユーザー taisii2taisii2
提出日時 2022-08-20 16:28:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 195,836 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 14:59:32
合計ジャッジ時間 4,520 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 1 ms
6,940 KB
testcase_08 WA -
testcase_09 AC 1 ms
6,940 KB
testcase_10 WA -
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 15 ms
6,944 KB
testcase_14 AC 10 ms
6,944 KB
testcase_15 AC 7 ms
6,940 KB
testcase_16 WA -
testcase_17 AC 23 ms
6,944 KB
testcase_18 AC 8 ms
6,940 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 24 ms
6,940 KB
testcase_22 WA -
testcase_23 AC 10 ms
6,940 KB
testcase_24 AC 21 ms
6,940 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 17 ms
6,944 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 41 ms
6,944 KB
testcase_36 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] == -1) {
      A[i] = 0;
    } else {
      A[i] = 1;
    }
  }
  vector<int> cnt(2, 0);
  for (int i = 0; i < N; i++) {
    cnt[A[i]]++;
  }
  if (cnt[0] == 0) {
    cout << "Second" << endl;
  } else if (cnt[0] == 1) {
    cout << "First" << endl;
  } else {
    if (abs(cnt[0] - cnt[1]) % 2 == 0) {
      cout << "First" << endl;
    } else {
      cout << "Second" << endl;
    }
  }
}
0