結果

問題 No.761 平均値ゲーム
ユーザー kotatsugame
提出日時 2020-02-22 20:17:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 521 ms
コンパイル使用メモリ 64,708 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-09 20:47:30
合計ジャッジ時間 6,917 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 68 WA * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N;
long A[1<<17];
bool dp[1<<17];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	long sum=0;
	for(int i=N;i--;)
	{
		sum+=A[i];
		long cnt=N-i;
		{
			int L=i-1,R=N;
			while(R-L>1)
			{
				int M=L+R>>1;
				if(A[M]*cnt>=sum)R=M;
				else L=M;
			}
			if(i<R&&!dp[R])
			{
				dp[i]=true;
				continue;
			}
		}
		{
			int L=i-1,R=N;
			while(R-L>1)
			{
				int M=L+R>>1;
				if(A[M]*cnt>sum)R=M;
				else L=M;
			}
			if(i<R&&!dp[R])
			{
				dp[i]=true;
				continue;
			}
		}
	}
	cout<<(dp[0]?"First":"Second")<<endl;
}
0