結果

問題 No.761 平均値ゲーム
コンテスト
ユーザー chocorusk
提出日時 2018-12-09 00:18:35
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 768 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 965 ms
コンパイル使用メモリ 123,428 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-04 14:11:43
合計ジャッジ時間 4,239 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge5_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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){
	ll c=r-l+1;
	ll m=(s[r]-s[l-1]+c-1)/c;
	if(a[l]==m) return true;
	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;
}
0