結果
| 問題 | No.1208 anti primenumber game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-13 18:25:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 425 bytes |
| 記録 | |
| コンパイル時間 | 1,707 ms |
| コンパイル使用メモリ | 192,120 KB |
| 最終ジャッジ日時 | 2025-01-14 14:32:00 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf("%d%lld",&n,&m);
| ~~~~~^~~~~~~~~~~~~~~~
main.cpp:24:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
24 | rep(i,n) scanf("%lld",&a[i]);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using lint=long long;
int n;
lint m,a[200000];
lint dfs(int i){
if(i==n) return 0;
lint tmp=dfs(i+1);
lint res=a[i]-m-tmp; // 全部取る
if(a[i]>1){
res=max(res,a[i]-1+m+tmp); // 1 個残す
}
return res;
}
int main(){
scanf("%d%lld",&n,&m);
rep(i,n) scanf("%lld",&a[i]);
puts(dfs(0)>0?"First":"Second");
return 0;
}