結果

問題 No.1208 anti primenumber game
ユーザー chocoruskchocorusk
提出日時 2020-08-30 22:00:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 1,045 bytes
コンパイル時間 1,279 ms
コンパイル使用メモリ 126,976 KB
実行使用メモリ 8,296 KB
最終ジャッジ日時 2024-04-27 13:27:00
合計ジャッジ時間 4,550 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 32 ms
8,144 KB
testcase_16 AC 32 ms
8,040 KB
testcase_17 AC 31 ms
8,092 KB
testcase_18 AC 32 ms
8,168 KB
testcase_19 AC 32 ms
8,120 KB
testcase_20 AC 32 ms
8,104 KB
testcase_21 AC 32 ms
8,040 KB
testcase_22 AC 34 ms
8,144 KB
testcase_23 AC 33 ms
8,156 KB
testcase_24 AC 104 ms
8,124 KB
testcase_25 AC 105 ms
8,168 KB
testcase_26 AC 98 ms
8,152 KB
testcase_27 AC 97 ms
8,096 KB
testcase_28 AC 100 ms
8,172 KB
testcase_29 AC 102 ms
8,136 KB
testcase_30 AC 33 ms
8,064 KB
testcase_31 AC 30 ms
8,092 KB
testcase_32 AC 33 ms
8,164 KB
testcase_33 AC 32 ms
8,236 KB
testcase_34 AC 32 ms
8,156 KB
testcase_35 AC 32 ms
8,132 KB
testcase_36 AC 26 ms
7,324 KB
testcase_37 AC 32 ms
8,156 KB
testcase_38 AC 79 ms
8,168 KB
testcase_39 AC 79 ms
8,164 KB
testcase_40 AC 93 ms
8,296 KB
testcase_41 AC 38 ms
8,220 KB
testcase_42 AC 37 ms
8,216 KB
testcase_43 AC 39 ms
8,092 KB
testcase_44 AC 38 ms
7,976 KB
testcase_45 AC 39 ms
8,036 KB
testcase_46 AC 31 ms
7,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; ll m;
	cin>>n>>m;
	ll a[200020];
	for(int i=0; i<n; i++) cin>>a[i];
	ll dp[2][200020];
	dp[0][n]=dp[1][n]=0;
	for(int i=n-1; i>=0; i--){
		for(int j=0; j<2; j++){
			dp[j][i]=a[i]-m-dp[j^1][i+1];
			if(a[i]>1){
				dp[j][i]=max(dp[j][i], a[i]-2+m+dp[j][i+1]);
			}
			if(a[i]>4){
				dp[j][i]=max(dp[j][i], a[i]-4-max(4-m-dp[j][i+1], 2+m+dp[j^1][i+1]));
			}
		}
	}
	if(dp[0][0]>0) cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	return 0;
}
0