結果
問題 | No.761 平均値ゲーム |
ユーザー |
![]() |
提出日時 | 2019-01-27 20:41:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 67 ms / 2,000 ms |
コード長 | 911 bytes |
コンパイル時間 | 2,193 ms |
コンパイル使用メモリ | 195,940 KB |
最終ジャッジ日時 | 2025-01-06 20:39:13 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#include<bits/stdc++.h>using namespace std;using Int = long long;template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}//INSERT ABOVE HEREsigned main(){Int n;cin>>n;vector<Int> a(n);for(Int i=0;i<n;i++) cin>>a[i];vector<Int> s(n+1,0);for(Int i=0;i<n;i++) s[i+1]=s[i]+a[i];function<Int(Int, Int)> dfs=[&](Int l,Int r)->Int{Int x=s[r]-s[l];Int y=r-l;//cout<<l<<" "<<r<<":"<<x<<" "<<y<<endl;if(a[l]*y>=x){assert(a[l]*y==x);return 1;}Int L=l,R=r;while(L+1<R){Int M=(L+R)>>1;if(a[M]*y>=x) R=M;else L=M;}Int res=0;res|=!dfs(l,R);res|=!dfs(R,r);return res;};cout<<(dfs(0,n)?"First":"Second")<<endl;return 0;}