結果

問題 No.702 中央値を求めよ LIMITED
ユーザー tjaketjake
提出日時 2018-06-15 23:15:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 2,084 bytes
コンパイル時間 966 ms
コンパイル使用メモリ 83,844 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 21:00:20
合計ジャッジ時間 37,143 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,239 ms
5,248 KB
testcase_01 AC 1,186 ms
5,248 KB
testcase_02 AC 1,186 ms
5,376 KB
testcase_03 AC 1,237 ms
5,376 KB
testcase_04 AC 1,228 ms
5,376 KB
testcase_05 AC 1,232 ms
5,376 KB
testcase_06 AC 1,232 ms
5,376 KB
testcase_07 AC 1,241 ms
5,376 KB
testcase_08 AC 1,184 ms
5,376 KB
testcase_09 AC 1,241 ms
5,376 KB
testcase_10 AC 1,250 ms
5,376 KB
testcase_11 AC 1,253 ms
5,376 KB
testcase_12 AC 1,253 ms
5,376 KB
testcase_13 AC 1,230 ms
5,376 KB
testcase_14 AC 1,247 ms
5,376 KB
testcase_15 AC 1,243 ms
5,376 KB
testcase_16 AC 1,191 ms
5,376 KB
testcase_17 AC 1,195 ms
5,376 KB
testcase_18 AC 1,258 ms
5,376 KB
testcase_19 AC 1,237 ms
5,376 KB
testcase_20 AC 1,237 ms
5,376 KB
testcase_21 AC 1,287 ms
5,376 KB
testcase_22 AC 1,227 ms
5,376 KB
testcase_23 AC 1,198 ms
5,376 KB
testcase_24 AC 1,189 ms
5,376 KB
testcase_25 WA -
testcase_26 AC 1,249 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<ctime>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define P_TYPE int
typedef pair<P_TYPE, P_TYPE> P;
typedef pair<P, P_TYPE> PI;
typedef pair<P_TYPE, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

#define uint32_t unsigned int

uint32_t x = 0, y = 1, z = 2, w = 3;
uint32_t gen() {
    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;
    ll left = 2144000000, right = 2150000000;
    int v = 10000001 / 2;
    while(left + 1 < right) {
      ll mid = (left + right) / 2;
      x = seed; y = 1; z = 2; w = 3;
      int cnt = 0;
      for(int i = 0; i < 10000001; i++) {
        if(gen() > mid) {
          cnt++;
          if(cnt > v) break;
        }

      }
      if(cnt > v) {
        left = mid;
      } else {
        right = mid;
      }
    }
    cout << (left + 1) << endl;
    return 0;
}
0