結果

問題 No.761 平均値ゲーム
ユーザー 👑 kmjpkmjp
提出日時 2018-12-09 00:07:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,150 bytes
コンパイル時間 1,091 ms
コンパイル使用メモリ 145,836 KB
実行使用メモリ 5,220 KB
最終ジャッジ日時 2023-10-12 19:06:41
合計ジャッジ時間 5,313 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,352 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 1 ms
4,352 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,352 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,352 KB
testcase_26 AC 1 ms
4,352 KB
testcase_27 AC 1 ms
4,352 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 3 ms
4,348 KB
testcase_36 AC 9 ms
4,364 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 4 ms
4,352 KB
testcase_44 AC 11 ms
4,348 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 3 ms
4,348 KB
testcase_53 WA -
testcase_54 AC 11 ms
4,348 KB
testcase_55 WA -
testcase_56 AC 6 ms
4,352 KB
testcase_57 WA -
testcase_58 AC 4 ms
4,352 KB
testcase_59 WA -
testcase_60 AC 6 ms
4,348 KB
testcase_61 AC 18 ms
5,000 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 AC 3 ms
4,348 KB
testcase_67 AC 6 ms
4,352 KB
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 AC 6 ms
4,348 KB
testcase_74 WA -
testcase_75 WA -
testcase_76 AC 6 ms
4,348 KB
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 AC 4 ms
4,348 KB
testcase_81 WA -
testcase_82 AC 12 ms
4,352 KB
testcase_83 AC 19 ms
4,912 KB
testcase_84 AC 20 ms
5,220 KB
testcase_85 AC 19 ms
4,912 KB
testcase_86 AC 19 ms
5,004 KB
testcase_87 AC 20 ms
4,984 KB
testcase_88 AC 19 ms
4,964 KB
testcase_89 AC 19 ms
5,056 KB
testcase_90 AC 19 ms
4,936 KB
testcase_91 AC 19 ms
4,912 KB
testcase_92 AC 19 ms
4,968 KB
testcase_93 AC 2 ms
4,348 KB
testcase_94 WA -
testcase_95 AC 15 ms
4,944 KB
testcase_96 AC 17 ms
5,076 KB
testcase_97 AC 16 ms
4,928 KB
testcase_98 WA -
testcase_99 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll A[101010];
ll S[101010];

int win(int L,int R) {
	if(R<=L) return 0;
	if(L+1==R) return 1;
	
	ll sum=S[R]-S[L];
	int x;
	ll M=R-1;
	for(x=20;x>=0;x--) if(M-(1<<x)>=L) {
		if(A[M-(1<<x)]*(R-L)>=sum) M-=1<<x;
	}
	
	if(L==M) return 1;
	
	int a=win(L,M-1)==0;
	int b=win(M,R)==0;
	return a||b;
	
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>A[i];
		S[i+1]=S[i]+A[i];
	}
	
	if(win(0,N)) cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0