結果

問題 No.702 中央値を求めよ LIMITED
ユーザー t98slidert98slider
提出日時 2022-06-10 06:13:46
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 1,574 ms
コンパイル使用メモリ 167,164 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 04:36:52
合計ジャッジ時間 21,719 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 670 ms
4,348 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 671 ms
4,348 KB
testcase_05 AC 671 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 671 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 669 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 672 ms
4,348 KB
testcase_20 WA -
testcase_21 AC 670 ms
4,348 KB
testcase_22 AC 672 ms
4,348 KB
testcase_23 AC 670 ms
4,348 KB
testcase_24 AC 671 ms
4,348 KB
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

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(){
    int64_t seed;
    uint32_t ok = -1, ng = 1 << 31 , mid, N = 10000001;
    cin >> seed;
    while(ok + 1 < ng){
        mid = (ok + ng) / 2;
        x = seed, y = 1, z = 2, w = 3;
        uint32_t cnt = 0;
        for(uint32_t i = 0; i < N; i++){
            cnt += (mid >= generate());
        }
        if(cnt < (N + 1) / 2)ok = mid;
        else ng = mid;
    }
    cout << ok + 1 << endl;
}
0