結果
| 問題 | No.761 平均値ゲーム | 
| コンテスト | |
| ユーザー |  chocorusk | 
| 提出日時 | 2018-12-09 00:15:36 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 53 ms / 2,000 ms | 
| コード長 | 853 bytes | 
| コンパイル時間 | 934 ms | 
| コンパイル使用メモリ | 95,700 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-14 17:55:19 | 
| 合計ジャッジ時間 | 5,579 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 100 | 
ソースコード
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n;
ll a[100001];
ll s[100001];
bool solve(int l, int r){
	bool same=1;
	for(int i=l+1; i<=r; i++){
		if(a[i]!=a[l]){
			same=0;
			break;
		}
	}
	if(same) return true;
	ll c=r-l+1;
	ll m=(s[r]-s[l-1]+c-1)/c;
	int t=lower_bound(a+l, a+r+1, m)-a;
	if(solve(l, t-1) && solve(t, r)) return false;
	else return true;
}
int main()
{
	cin>>n;
	for(int i=1; i<=n; i++){
		cin>>a[i];
		s[i]=s[i-1]+a[i];
	}
	if(solve(1, n)) cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	return 0;
}
            
            
            
        