結果

問題 No.702 中央値を求めよ LIMITED
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2018-06-15 22:43:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 1,374 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 94,192 KB
実行使用メモリ 8,988 KB
最終ジャッジ日時 2023-08-14 21:07:42
合計ジャッジ時間 5,629 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
8,408 KB
testcase_01 AC 125 ms
7,500 KB
testcase_02 AC 126 ms
8,140 KB
testcase_03 AC 125 ms
8,264 KB
testcase_04 AC 126 ms
8,988 KB
testcase_05 AC 126 ms
7,872 KB
testcase_06 AC 127 ms
8,012 KB
testcase_07 AC 125 ms
7,564 KB
testcase_08 AC 126 ms
7,672 KB
testcase_09 AC 126 ms
7,560 KB
testcase_10 AC 126 ms
7,488 KB
testcase_11 AC 126 ms
7,956 KB
testcase_12 AC 125 ms
8,068 KB
testcase_13 AC 125 ms
7,772 KB
testcase_14 AC 125 ms
7,772 KB
testcase_15 AC 126 ms
7,668 KB
testcase_16 AC 127 ms
8,412 KB
testcase_17 AC 126 ms
8,596 KB
testcase_18 AC 126 ms
8,060 KB
testcase_19 AC 126 ms
7,612 KB
testcase_20 AC 126 ms
7,564 KB
testcase_21 AC 126 ms
7,540 KB
testcase_22 AC 126 ms
8,080 KB
testcase_23 AC 125 ms
7,304 KB
testcase_24 AC 125 ms
7,492 KB
testcase_25 AC 126 ms
7,660 KB
testcase_26 AC 125 ms
8,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

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;
    ll b = 0;
    vector<ll> v;
    for (int i = 0; i < 10000001; i++) {
        ll r = generate();
        if(r<2000000000){
          b++;
        }
        else if(r>2200000000){
          // 何もしないよ
        }
        else{
          v.pb(r);
        }
    }
    sort(all(v));
    ll l = 5000000 - b;
    cout << v[l] << endl;
    return 0;
}
0