結果
問題 | No.761 平均値ゲーム |
ユーザー |
![]() |
提出日時 | 2018-12-19 01:08:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 1,088 bytes |
コンパイル時間 | 1,327 ms |
コンパイル使用メモリ | 160,680 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 07:51:34 |
合計ジャッジ時間 | 6,346 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(int)(n);i++)#define rep1(i,n) for(int i=1;i<=(int)(n);i++)#define all(c) c.begin(),c.end()#define pb push_back#define fs first#define sc second#define show(x) cout << #x << " = " << (x) << endl#define chmin(x,y) x=min(x,y)#define chmax(x,y) x=max(x,y)using namespace std;template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"{";for(const T& v:vc) o<<v<<",";o<<"}";return o;}using ll = long long;template<class T> using V = vector<T>;template<class T> using VV = vector<vector<T>>;int N;V<ll> a;bool Awin(int l,int r){if(l==r) return false;ll n = r-l;ll sm = 0;for(int i=l;i<r;i++) sm += a[i];int m = l-1;for(int i=l;i<r;i++){if(a[i]*n<sm) m = i;}bool can = false;if(m!=l-1){can |= !Awin(m+1,r);}can |= !Awin(l,m+1);return can;}int main(){cin>>N;a.resize(N);rep(i,N) cin>>a[i];if(Awin(0,N)) puts("First");else puts("Second");}