結果
| 問題 | No.702 中央値を求めよ LIMITED |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-28 20:18:32 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 499 ms / 5,000 ms |
| コード長 | 734 bytes |
| 記録 | |
| コンパイル時間 | 563 ms |
| コンパイル使用メモリ | 78,408 KB |
| 実行使用メモリ | 23,328 KB |
| 最終ジャッジ日時 | 2026-03-08 19:05:42 |
| 合計ジャッジ時間 | 14,774 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
uint32_t x = 0, y = 1, z = 2, w = 3;
uint32_t a[6000001];
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;
int l1bcnt = 0;
int index = 0;
for (int i = 0; i < 10000001; i++) {
uint32_t next_num = generate();
if (next_num < 1000000000) {
l1bcnt++;
} else if (next_num < 3000000000L) {
a[index] = next_num;
index++;
}
}
int median_index = 10000001 / 2 - l1bcnt;
sort(a, a + index);
cout << a[median_index] << endl;
}