結果

問題 No.1208 anti primenumber game
ユーザー m_tsubasam_tsubasa
提出日時 2020-08-30 13:50:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 765 bytes
コンパイル時間 2,268 ms
コンパイル使用メモリ 209,668 KB
実行使用メモリ 15,852 KB
最終ジャッジ日時 2024-04-27 07:08:49
合計ジャッジ時間 5,822 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 48 ms
15,680 KB
testcase_16 AC 46 ms
15,700 KB
testcase_17 AC 46 ms
15,744 KB
testcase_18 AC 49 ms
15,796 KB
testcase_19 AC 48 ms
15,688 KB
testcase_20 AC 48 ms
15,848 KB
testcase_21 WA -
testcase_22 AC 49 ms
15,660 KB
testcase_23 WA -
testcase_24 AC 121 ms
15,724 KB
testcase_25 AC 122 ms
15,768 KB
testcase_26 AC 116 ms
15,820 KB
testcase_27 AC 116 ms
15,820 KB
testcase_28 AC 114 ms
15,740 KB
testcase_29 AC 115 ms
15,764 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 48 ms
15,768 KB
testcase_33 AC 47 ms
15,852 KB
testcase_34 AC 48 ms
15,656 KB
testcase_35 AC 48 ms
15,800 KB
testcase_36 AC 37 ms
13,100 KB
testcase_37 AC 47 ms
15,656 KB
testcase_38 AC 95 ms
15,668 KB
testcase_39 AC 96 ms
15,696 KB
testcase_40 AC 112 ms
15,844 KB
testcase_41 AC 54 ms
15,812 KB
testcase_42 AC 55 ms
15,652 KB
testcase_43 WA -
testcase_44 AC 55 ms
15,800 KB
testcase_45 WA -
testcase_46 AC 45 ms
14,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long n, m;
vector<vector<long long>> dp;
vector<long long> a;

int main() {
  cin >> n >> m;
  a.resize(n);
  for (auto &p : a) cin >> p;
  reverse(a.begin(), a.end());
  dp.assign(n, vector<long long>(2, (long long)(-1e18)));
  dp[0][0] = a[0] - 2 + m;
  dp[0][1] = a[0] - m;
  for (int i = 1; i < n; ++i) {
    long long manum = dp[i - 1][1], minum = dp[i - 1][1];
    if (a[i - 1] != 1) {
      manum = max(manum, dp[i - 1][0]);
      minum = min(minum, dp[i - 1][0]);
    }
    // 0
    dp[i][0] = manum + a[i] - 2 + m;
    // 1
    dp[i][1] = -minum + a[i] - m;
  }
  if ((dp[n - 1][0] > 0 && a[n - 1] != 1) || dp[n - 1][1] > 0)
    cout << "First" << endl;
  else
    cout << "Second" << endl;
  return 0;
}
0