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