結果
問題 |
No.702 中央値を求めよ LIMITED
|
ユーザー |
![]() |
提出日時 | 2018-06-16 12:39:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 978 bytes |
コンパイル時間 | 1,787 ms |
コンパイル使用メモリ | 168,728 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 04:46:27 |
合計ジャッジ時間 | 63,818 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 WA * 2 |
ソースコード
#include<bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1e9+7 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long 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(){ uint32_t seed; cin>>seed; x=seed; deque<uint32_t>a; ll left=0,right=pow(2,32); ll mid=0; while(right-left>1){ // cout<<left<<" "<<right<<endl; mid=(left+right)/2; x=seed;y=1;z=2;w=3; int cnt=0; int cnt2=0; for(int i=0;i<10000001;i++){ ll num=generate(); if(mid<num) cnt++; else if(mid>num) cnt2++; } if(cnt==5000000&&cnt2==5000000){cout<<mid<<endl;break;} else if(cnt<5000000){ right=mid; }else if(cnt>5000000){ left=mid; }else if(cnt==5000000){ right=mid; } } //cout<<mid<<endl; return 0; }