結果

問題 No.702 中央値を求めよ LIMITED
ユーザー face4
提出日時 2018-11-17 21:29:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 65,320 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-24 14:41:47
合計ジャッジ時間 22,282 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 12 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<climits>
using namespace std;

uint32_t x = 0, y = 1, z = 2, w = 3;

void init(){
    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;
}

typedef long long ll;

int main(){
    int64_t seed;
    cin >> seed;

    uint32_t l = 0, r = UINT_MAX;

    while(r-l > 1){
        init();
        x = seed;
        uint32_t mid = l + (r-l)/2, tmp;
        int cnt = 0;
        for(int i = 0; i < 10000001; i++){
            tmp = generate();
            if(tmp <= mid)    cnt++;
        }

        if(cnt >= 5000001)  r = mid;
        else                l = mid+1;
    }

    cout << r << endl;

    return 0;
}
0