No.702 Find the Median LIMITED
問題文最終更新日: 2026-06-26 00:24:00
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 193
(順位表)
の他の問題:
Problem Statement
Find the median of the sequence $a$.
Since this would be far too easy for all you pros, I have set the memory limit to 32MB.
Input
seed
$|a| = 10000001$ (10 million and 1 elements)
$1 \le seed \le 100000$
The sequence $a$ is generated by a pseudorandom number generation algorithm called XOR Shift, implemented in C++ below.
Note that uint32_t is a 32-bit unsigned integer type.
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) {
int64_t seed; cin >> seed;
x = seed;
uint32_t a[10000001];
for (int i = 0; i < 10000001; i++) {
a[i] = generate();
}
for (int i = 0; i < 10000001; i++) {
cout << a[i] << endl;
}
return 0;
}
Output
Output the median on one line. Print a newline at the end.
Sample
Sample 1
Input
1
Output
2147058707
The generated sequence is 2058, 3, 4113, 2058, 4198488, 4196427, 12587210, 8390784, 4332056, 4212747, 413321, ....
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
はむこ
e869120