結果

問題 No.702 中央値を求めよ LIMITED
ユーザー vwxyz
提出日時 2022-06-22 05:01:13
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 638 ms / 5,000 ms
コード長 697 bytes
コンパイル時間 2,776 ms
コンパイル使用メモリ 243,444 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 07:15:01
合計ジャッジ時間 20,989 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <stdio.h>
uint32_t x,y,z,w;
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; 
    long long ok,ng;ok=0,ng=1ll<<32;
    while(abs(ok-ng)>1){
        x=seed;y=1;z=2;w=3;
        long long mid=(ok+ng)/2;
        int cnt=0;
        for (int i = 0; i < 10000001; i++) {
            uint32_t a = generate();
            if(a<mid){
                cnt+=1;
            }
        }
        if(cnt<=5000000){
            ok=mid;
        }
        else{
            ng=mid;
        }
    }
    cout<<ok<<endl;
}
0