結果
問題 |
No.1208 anti primenumber game
|
ユーザー |
|
提出日時 | 2020-10-07 23:02:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 105 ms / 2,000 ms |
コード長 | 421 bytes |
コンパイル時間 | 636 ms |
コンパイル使用メモリ | 66,432 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 04:19:15 |
合計ジャッジ時間 | 4,754 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 8 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int N; long M; long A[2<<17]; long dp[2]; main() { cin>>N>>M; for(int i=0;i<N;i++)cin>>A[i]; for(int i=N;i--;) { long nxt[2]; nxt[0]=A[i]-M-dp[1]; nxt[1]=A[i]-M-dp[0]; if(A[i]>1) { nxt[0]=max(nxt[0],A[i]-1-(1-M)+dp[0]); nxt[1]=max(nxt[1],A[i]-1-(1-M)+dp[1]); } dp[0]=nxt[0]; dp[1]=nxt[1]; } cout<<(dp[0]>0?"First":"Second")<<endl; }