結果

問題 No.702 中央値を求めよ LIMITED
ユーザー kotatsugame
提出日時 2022-08-15 04:06:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 491 ms / 5,000 ms
コード長 367 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 64,256 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-01 18:40:56
合計ジャッジ時間 15,293 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
unsigned int m,seed,n=1e7+1,t,x,y,z,w,f=2144000000L,l=2151000000L;
main()
{
	cin>>seed;
	while(l-f>1)
	{
		m=((long)f+(long)l)/2;
		x=seed;y=1,z=2,w=3;
		int cnt=0;
		for(int i=0;i<n;i++)
		{
			t=(x^(x<<11));
			x=y,y=z,z=w;
			w=(w^(w>>19))^(t^(t>>8));
			cnt+=w<=m;
		}
		if(cnt<5000001)f=m;
		else l=m;
	}
	cout<<l<<endl;
}
0