結果

問題 No.702 中央値を求めよ LIMITED
ユーザー convexineqconvexineq
提出日時 2021-03-17 20:58:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 762 bytes
コンパイル時間 1,974 ms
コンパイル使用メモリ 200,508 KB
実行使用メモリ 7,396 KB
最終ジャッジ日時 2024-04-27 13:30:46
合計ジャッジ時間 4,530 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
7,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 60 ms
7,396 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 58 ms
7,112 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 60 ms
7,248 KB
testcase_18 WA -
testcase_19 AC 60 ms
7,168 KB
testcase_20 WA -
testcase_21 AC 60 ms
7,040 KB
testcase_22 AC 61 ms
7,244 KB
testcase_23 AC 60 ms
7,120 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
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(void) {
    int64_t seed; cin >> seed; 
    x = seed;
    uint32_t v;
    int d = 1000000;
    int low = (1<<31)-d;
    uint32_t a[1000001];
    int cnt = 0;
    for (int i = 0; i < 10000001; i++) {
        v = generate();
        if (v < low) cnt += 1;
        else if (v < (low+d)) a[v-low] += 1;
    }
    int half = 5000000;
    //cout << cnt << endl;
    for (int i = 0; i < d; i++) {
        cnt += a[i];
        if (cnt > half){
            cout << i+low << endl;
            break;
        }
    }
    return 0;
}

0