結果
| 問題 | No.702 中央値を求めよ LIMITED |
| コンテスト | |
| ユーザー |
ikd
|
| 提出日時 | 2018-06-15 23:39:10 |
| 言語 | C++11(old_compat) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 945 ms / 5,000 ms |
| コード長 | 681 bytes |
| 記録 | |
| コンパイル時間 | 1,428 ms |
| コンパイル使用メモリ | 166,000 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 16:17:30 |
| 合計ジャッジ時間 | 26,189 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
uint32_t x = 0, y = 1, z = 2, w = 3;
uint32_t generate() {
uint32_t t = (x^(x<<11));
x = y;
y = z;
z = w;
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
return w;
}
int main(void) {
uint32_t seed; cin >> seed;
x = seed;
int n=10000001;
long long yes=0, no=4294967296;
while(no-yes>1){
auto m=(yes+no)/2;
x=seed; y=1; z=2; w=3;
int cnt=0;
rep(_, n){
auto a=generate();
if(a<m) cnt++;
}
(cnt<=n/2 ? yes : no) = m;
}
cout<< yes<< endl;
return 0;
}
ikd