結果

問題 No.1208 anti primenumber game
ユーザー hedwig100hedwig100
提出日時 2020-09-06 15:14:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 1,004 bytes
コンパイル時間 1,458 ms
コンパイル使用メモリ 166,492 KB
実行使用メモリ 4,808 KB
最終ジャッジ日時 2023-08-19 13:58:13
合計ジャッジ時間 4,035 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 14 ms
4,580 KB
testcase_16 AC 13 ms
4,596 KB
testcase_17 AC 12 ms
4,492 KB
testcase_18 AC 12 ms
4,656 KB
testcase_19 AC 13 ms
4,688 KB
testcase_20 AC 13 ms
4,584 KB
testcase_21 AC 14 ms
4,632 KB
testcase_22 AC 13 ms
4,628 KB
testcase_23 AC 13 ms
4,648 KB
testcase_24 AC 28 ms
4,492 KB
testcase_25 AC 29 ms
4,620 KB
testcase_26 AC 27 ms
4,572 KB
testcase_27 AC 27 ms
4,636 KB
testcase_28 AC 29 ms
4,596 KB
testcase_29 AC 28 ms
4,488 KB
testcase_30 AC 12 ms
4,512 KB
testcase_31 AC 12 ms
4,516 KB
testcase_32 AC 13 ms
4,808 KB
testcase_33 AC 12 ms
4,648 KB
testcase_34 AC 13 ms
4,648 KB
testcase_35 AC 13 ms
4,576 KB
testcase_36 AC 10 ms
4,380 KB
testcase_37 AC 12 ms
4,572 KB
testcase_38 AC 23 ms
4,596 KB
testcase_39 AC 24 ms
4,692 KB
testcase_40 AC 27 ms
4,636 KB
testcase_41 AC 14 ms
4,656 KB
testcase_42 AC 15 ms
4,624 KB
testcase_43 AC 14 ms
4,652 KB
testcase_44 AC 14 ms
4,588 KB
testcase_45 AC 14 ms
4,576 KB
testcase_46 AC 13 ms
4,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    ll M;
    cin >> N >> M;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    ll dp0 = 0,dp1 = 0,tot = 0;;
    irep(i,N) {
        tot += A[i] - M;
        ll new0,new1;
        if (A[i] > 1) {
            new0 = max(A[i] - M + dp1,A[i] - 1 + dp0);
            new1 = min(dp0,-M + dp1);
        } else {
            new0 = 1 - M + dp1;
            new1 = dp0;
        }
        swap(dp0,new0);
        swap(dp1,new1);
    }
    cout << (2*dp0 > tot ? "First" : "Second") << '\n';
    return 0;
}
0