結果
| 問題 |
No.702 中央値を求めよ LIMITED
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-16 09:48:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 566 bytes |
| コンパイル時間 | 1,645 ms |
| コンパイル使用メモリ | 166,100 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 04:43:39 |
| 合計ジャッジ時間 | 12,316 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 WA * 2 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
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) {
int64_t seed; cin >> seed;
uint64_t l=UINT_MAX/1001*500,r=UINT_MAX/1001*501;
while(r-l>1){
uint64_t t=(l+r)/2;
int cnt=0;
x=seed;y=1;z=2;w=3;
for(int i=0;i<10000001;i++){
if(generate()<t)cnt++;
}
if(cnt<=10000001/2)l=t;
else r=t;
}
cout<<l<<endl;
}