結果

問題 No.1208 anti primenumber game
ユーザー auauaauaua
提出日時 2020-08-30 16:19:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 1,214 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 168,436 KB
実行使用メモリ 18,944 KB
最終ジャッジ日時 2024-04-27 09:54:37
合計ジャッジ時間 5,781 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 4 ms
6,948 KB
testcase_02 AC 4 ms
6,944 KB
testcase_03 AC 4 ms
6,940 KB
testcase_04 AC 4 ms
6,944 KB
testcase_05 AC 4 ms
6,944 KB
testcase_06 AC 4 ms
6,940 KB
testcase_07 AC 4 ms
6,940 KB
testcase_08 AC 4 ms
6,944 KB
testcase_09 AC 4 ms
6,944 KB
testcase_10 AC 4 ms
6,944 KB
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 4 ms
6,944 KB
testcase_14 AC 4 ms
6,944 KB
testcase_15 AC 46 ms
18,816 KB
testcase_16 AC 45 ms
18,944 KB
testcase_17 AC 45 ms
18,944 KB
testcase_18 AC 45 ms
18,944 KB
testcase_19 AC 45 ms
18,816 KB
testcase_20 AC 45 ms
18,816 KB
testcase_21 AC 48 ms
18,816 KB
testcase_22 AC 47 ms
18,944 KB
testcase_23 AC 45 ms
18,816 KB
testcase_24 AC 121 ms
18,944 KB
testcase_25 AC 122 ms
18,944 KB
testcase_26 AC 114 ms
18,944 KB
testcase_27 AC 115 ms
18,816 KB
testcase_28 AC 113 ms
18,944 KB
testcase_29 AC 114 ms
18,816 KB
testcase_30 AC 44 ms
18,944 KB
testcase_31 AC 44 ms
18,944 KB
testcase_32 AC 45 ms
18,944 KB
testcase_33 AC 45 ms
18,944 KB
testcase_34 AC 45 ms
18,816 KB
testcase_35 AC 45 ms
18,944 KB
testcase_36 AC 35 ms
16,128 KB
testcase_37 AC 45 ms
18,816 KB
testcase_38 AC 93 ms
18,944 KB
testcase_39 AC 96 ms
18,944 KB
testcase_40 AC 111 ms
18,816 KB
testcase_41 AC 51 ms
18,944 KB
testcase_42 AC 51 ms
18,816 KB
testcase_43 AC 51 ms
18,816 KB
testcase_44 AC 52 ms
18,944 KB
testcase_45 AC 52 ms
18,816 KB
testcase_46 AC 42 ms
17,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll inf=1e9+7;
const ll mod=1e9+7;
const int MAX=200010;

vector<ll>dp(MAX,-inf*inf);
vector<ll>a(MAX);
ll n,m;
ll solve(ll i){
    if(i==n-1){
        dp[i]=a[i]-m;
        if(a[i]>1)dp[i]=max(dp[i],a[i]-1-(1-m));
        return dp[i];
    }
    if(dp[i]>-inf*inf)return dp[i];
    ll res=a[i]-m-solve(i+1);
    if(a[i]>1){
        res=max(res,solve(i+1)+a[i]-1-(1-m));
    }
    if(a[i]>4){
        res=max(res,a[i]-4-max(4-m-solve(i+1),3+solve(i+1)-(1-m)));
    }
    dp[i]=res;
    return res;
}

signed main(){
    cin>>n>>m;
    rep(i,n){
        cin>>a[i];
    }
    ll ans=solve(0);
    rep(i,n){
        //cout<<i<<' '<<dp[i]<<endl;
    }
    if(ans>0)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}
0