結果
| 問題 | No.702 中央値を求めよ LIMITED |
| コンテスト | |
| ユーザー |
hirokazu1020
|
| 提出日時 | 2018-06-15 22:40:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 760 ms / 5,000 ms |
| コード長 | 1,127 bytes |
| 記録 | |
| コンパイル時間 | 1,075 ms |
| コンパイル使用メモリ | 93,092 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-22 22:02:13 |
| 合計ジャッジ時間 | 23,067 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
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;
}
void init(uint32_t seed) {
x = seed;
y = 1;
z = 2;
w = 3;
}
int main(void) {
uint32_t seed; cin >> seed;
uint32_t ans = 0;
const int n = 10000001;
rep(i,32) {
uint32_t mask = ans | 1 << (32 - i - 1);
int cnt = 0;
init(seed);
rep(j, n) {
cnt += generate() >= mask;
}
if (cnt >= (n+1) / 2)ans = mask;
}
cout << ans << endl;
return 0;
}
hirokazu1020