結果

問題 No.1478 Simple Sugoroku
ユーザー kotatsugame
提出日時 2021-04-24 05:07:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 70,472 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 08:58:47
合計ジャッジ時間 3,874 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<iomanip>
using namespace std;
int N,M;
int B[1<<17];
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)cin>>B[i];
	double L=0,R=2e9;
	for(int c=0;c<100;c++)
	{
		double mid=(L+R)/2;
		double now=0;
		for(int i=0;i<M;i++)
		{
			double x=N-B[i];
			if(x<mid)now+=x;
			else now+=mid;
		}
		now/=M;
		now+=1;
		if(mid<now)L=mid;
		else R=mid;
	}
	double ans=L+B[0]-1;
	if(ans>N-1)ans=N-1;
	cout<<fixed<<setprecision(16)<<ans<<endl;
}
0