結果

問題 No.702 中央値を求めよ LIMITED
ユーザー convexineqconvexineq
提出日時 2021-03-17 21:18:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 931 bytes
コンパイル時間 2,145 ms
コンパイル使用メモリ 194,056 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2024-04-24 21:06:22
合計ジャッジ時間 4,544 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,248 KB
testcase_01 AC 64 ms
21,248 KB
testcase_02 AC 63 ms
21,376 KB
testcase_03 AC 63 ms
21,376 KB
testcase_04 AC 63 ms
21,248 KB
testcase_05 AC 62 ms
21,248 KB
testcase_06 AC 64 ms
21,248 KB
testcase_07 AC 66 ms
21,120 KB
testcase_08 AC 65 ms
20,992 KB
testcase_09 AC 65 ms
21,248 KB
testcase_10 AC 66 ms
21,376 KB
testcase_11 AC 65 ms
21,248 KB
testcase_12 AC 67 ms
21,248 KB
testcase_13 AC 65 ms
21,248 KB
testcase_14 AC 67 ms
21,120 KB
testcase_15 AC 65 ms
21,248 KB
testcase_16 AC 65 ms
21,376 KB
testcase_17 AC 63 ms
21,120 KB
testcase_18 AC 69 ms
21,376 KB
testcase_19 AC 71 ms
21,376 KB
testcase_20 AC 68 ms
21,248 KB
testcase_21 AC 61 ms
21,504 KB
testcase_22 AC 63 ms
21,376 KB
testcase_23 AC 63 ms
21,120 KB
testcase_24 AC 61 ms
21,120 KB
testcase_25 WA -
testcase_26 AC 65 ms
21,120 KB
権限があれば一括ダウンロードができます

ソースコード

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;
    const int d = 5000000;
    const long long low = (1LL<<31)-d/2;
    uint32_t a[5000001];
    int cnt = 0;
    int cnt2 = 0;
    for (int i = 0; i < 10000001; i++) {
        v = generate();
        if (v < low) cnt += 1;
        else if (v < (low+d)){
            a[v-low] += 1;
            cnt2 += 1;
        }
    }
    const int half = 5000000;
    //cout << cnt << endl;
    //cout << cnt+cnt2 << endl;
    for (int i = 0; i < d; i++) {
        cnt += a[i];
        if (cnt > half){
            //cout << i << " " << low << endl;
            cout << i+low << endl;
            break;
        }
    }
    return 0;
}
0