結果

問題 No.702 中央値を求めよ LIMITED
ユーザー titia
提出日時 2025-07-02 03:47:48
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 880 bytes
コンパイル時間 3,411 ms
コンパイル使用メモリ 281,404 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-07-02 03:47:56
合計ジャッジ時間 7,139 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 11 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <time.h>
#include <sys/time.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;
    std::vector<uint32_t> data;
    int S=0;
    for (int i = 0; i < 10000001; i++) {
        uint32_t a = generate();
        //cout<< a << endl;
        if (a<2147000000){
        	S-=1;
        }
        else if (a>2148000000){
        	S+=1;
        }
        else{
        	data.push_back(a);
        }
    }
    
    std::sort(data.begin(), data.end());
    //cout << S <<endl;
    
    if (data.size()%2==0){
    cout << data[data.size()/2+S/2-1] << endl;
    }
    else{
    	cout << data[data.size()/2+S/2] << endl;
    }

    return 0;
}
0