結果

問題 No.702 中央値を求めよ LIMITED
ユーザー chocoruskchocorusk
提出日時 2018-10-09 21:22:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 813 ms / 5,000 ms
コード長 825 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 91,500 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-14 21:46:00
合計ジャッジ時間 24,429 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 811 ms
4,380 KB
testcase_01 AC 812 ms
4,380 KB
testcase_02 AC 811 ms
4,380 KB
testcase_03 AC 811 ms
4,380 KB
testcase_04 AC 812 ms
4,380 KB
testcase_05 AC 811 ms
4,376 KB
testcase_06 AC 812 ms
4,376 KB
testcase_07 AC 811 ms
4,380 KB
testcase_08 AC 810 ms
4,376 KB
testcase_09 AC 811 ms
4,376 KB
testcase_10 AC 813 ms
4,380 KB
testcase_11 AC 810 ms
4,380 KB
testcase_12 AC 810 ms
4,376 KB
testcase_13 AC 810 ms
4,380 KB
testcase_14 AC 810 ms
4,376 KB
testcase_15 AC 810 ms
4,380 KB
testcase_16 AC 810 ms
4,380 KB
testcase_17 AC 810 ms
4,376 KB
testcase_18 AC 813 ms
4,376 KB
testcase_19 AC 811 ms
4,380 KB
testcase_20 AC 812 ms
4,380 KB
testcase_21 AC 812 ms
4,380 KB
testcase_22 AC 810 ms
4,376 KB
testcase_23 AC 812 ms
4,384 KB
testcase_24 AC 812 ms
4,376 KB
testcase_25 AC 812 ms
4,380 KB
testcase_26 AC 812 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef unsigned int uint;

const int n=10000001;

uint x, y, z, w;
uint generate() { 
    uint t = (x^(x<<11));
    x = y;
    y = z;
    z = w;
    w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); 
    return w;
}

int main()
{
	uint seed;
	cin>>seed;
	ll c1=0, c2=(1ll<<32)-1;
	while(c1!=c2){
		ll c=(c1+c2+1)/2;
		x=seed, y=1, z=2, w=3;
		int ct=0;
		for(int i=0; i<n; i++){
			uint a=generate();
			if(a<c) ct++;
		}
		if(ct>n/2) c2=c-1;
		else c1=c;
	}
	cout<<c1<<endl;
	return 0;
}
0