結果

問題 No.702 中央値を求めよ LIMITED
ユーザー finefine
提出日時 2018-06-15 22:46:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 751 bytes
コンパイル時間 1,765 ms
コンパイル使用メモリ 167,924 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:59:10
合計ジャッジ時間 5,182 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
5,248 KB
testcase_01 AC 76 ms
5,248 KB
testcase_02 AC 77 ms
5,376 KB
testcase_03 AC 77 ms
5,376 KB
testcase_04 AC 76 ms
5,376 KB
testcase_05 AC 76 ms
5,376 KB
testcase_06 AC 78 ms
5,376 KB
testcase_07 AC 76 ms
5,376 KB
testcase_08 AC 77 ms
5,376 KB
testcase_09 AC 78 ms
5,376 KB
testcase_10 AC 76 ms
5,376 KB
testcase_11 AC 76 ms
5,376 KB
testcase_12 AC 86 ms
5,376 KB
testcase_13 AC 88 ms
5,376 KB
testcase_14 AC 85 ms
5,376 KB
testcase_15 AC 85 ms
5,376 KB
testcase_16 AC 86 ms
5,376 KB
testcase_17 AC 86 ms
5,376 KB
testcase_18 AC 86 ms
5,376 KB
testcase_19 AC 86 ms
5,376 KB
testcase_20 AC 76 ms
5,376 KB
testcase_21 AC 75 ms
5,376 KB
testcase_22 AC 77 ms
5,376 KB
testcase_23 AC 76 ms
5,376 KB
testcase_24 AC 77 ms
5,376 KB
testcase_25 RE -
testcase_26 AC 77 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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(void) {
    ll seed; cin >> seed; 
    x = seed;
    int n = 10000001;
    uint32_t L = 2140000000, R = 2150000000;
    ll cntL = 0;
    vector<uint32_t> v;
    for (int i = 0; i < n; i++) {
        uint32_t x = generate();
        if (x >= L && x <= R) {
            v.push_back(x);
        } else if (x < L) {
            cntL++;
        }
    }
    sort(v.begin(), v.end());
    assert(cntL <= n / 2 && cntL + (ll)v.size() > n / 2);
    cout << v[n / 2 - cntL] << endl;
    return 0;
}
0