結果

問題 No.702 中央値を求めよ LIMITED
ユーザー face4face4
提出日時 2018-11-17 21:29:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 63,652 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 01:47:32
合計ジャッジ時間 20,160 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 629 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 631 ms
4,376 KB
testcase_05 AC 638 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 633 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 649 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 624 ms
4,380 KB
testcase_15 AC 631 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 634 ms
4,376 KB
testcase_20 AC 647 ms
4,376 KB
testcase_21 AC 649 ms
4,376 KB
testcase_22 WA -
testcase_23 AC 639 ms
4,376 KB
testcase_24 AC 636 ms
4,376 KB
testcase_25 AC 683 ms
4,376 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

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