結果
| 問題 | No.702 中央値を求めよ LIMITED | 
| コンテスト | |
| ユーザー |  chocorusk | 
| 提出日時 | 2018-10-09 21:22:11 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 618 ms / 5,000 ms | 
| コード長 | 825 bytes | 
| コンパイル時間 | 1,208 ms | 
| コンパイル使用メモリ | 93,200 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-22 22:42:06 | 
| 合計ジャッジ時間 | 19,691 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 25 | 
ソースコード
#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;
}
            
            
            
        