結果
| 問題 |
No.1208 anti primenumber game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-13 17:09:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 523 bytes |
| コンパイル時間 | 2,387 ms |
| コンパイル使用メモリ | 191,244 KB |
| 最終ジャッジ日時 | 2025-01-14 14:31:41 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | scanf("%d%lld",&n,&m);
| ~~~~~^~~~~~~~~~~~~~~~
main.cpp:27:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | 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;
const long long INF=1LL<<61;
int n;
lint m,a[200000];
lint cum[200001];
lint dfs(int i){
if(i==n) return 0;
lint tmp=dfs(i+1);
lint res=cum[n]-cum[i]-(n-i)*m-2*tmp; // 全部取る
if(a[i]>1){
res=max(res,tmp+a[i]-1+m); // 1 個残す
}
return res;
}
int main(){
scanf("%d%lld",&n,&m);
rep(i,n) scanf("%lld",&a[i]);
rep(i,n) cum[i+1]=cum[i]+a[i];
puts(dfs(0)>0?"First":"Second");
return 0;
}