結果

問題 No.702 中央値を求めよ LIMITED
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2018-06-15 22:43:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 1,374 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 95,476 KB
実行使用メモリ 7,504 KB
最終ジャッジ日時 2024-05-02 09:13:58
合計ジャッジ時間 4,636 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
7,372 KB
testcase_01 AC 113 ms
7,500 KB
testcase_02 AC 114 ms
7,372 KB
testcase_03 AC 111 ms
7,504 KB
testcase_04 AC 112 ms
7,376 KB
testcase_05 AC 111 ms
7,496 KB
testcase_06 AC 117 ms
7,372 KB
testcase_07 AC 110 ms
7,372 KB
testcase_08 AC 112 ms
7,368 KB
testcase_09 AC 114 ms
7,368 KB
testcase_10 AC 111 ms
7,372 KB
testcase_11 AC 112 ms
7,496 KB
testcase_12 AC 115 ms
7,496 KB
testcase_13 AC 120 ms
7,496 KB
testcase_14 AC 124 ms
7,372 KB
testcase_15 AC 119 ms
7,496 KB
testcase_16 AC 117 ms
7,500 KB
testcase_17 AC 113 ms
7,372 KB
testcase_18 AC 113 ms
7,432 KB
testcase_19 AC 113 ms
7,500 KB
testcase_20 AC 112 ms
7,352 KB
testcase_21 AC 113 ms
7,372 KB
testcase_22 AC 114 ms
7,372 KB
testcase_23 AC 116 ms
7,344 KB
testcase_24 AC 111 ms
7,372 KB
testcase_25 AC 114 ms
7,376 KB
testcase_26 AC 116 ms
7,500 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