結果
| 問題 | No.702 中央値を求めよ LIMITED |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-07-03 19:30:42 |
| 言語 | D (dmd 2.113.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 3,489 ms / 5,000 ms |
| + 53µs | |
| コード長 | 815 bytes |
| 記録 | |
| コンパイル時間 | 1,659 ms |
| コンパイル使用メモリ | 88,472 KB |
| 実行使用メモリ | 9,872 KB |
| 最終ジャッジ日時 | 2026-10-10 12:28:20 |
| 合計ジャッジ時間 | 101,556 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;
auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
const n = 10000001;
void main()
{
uint seed; readV(seed);
auto calc(uint m)
{
init(seed);
auto c = 0;
foreach (_; 0..n) {
auto a = generate();
if (a <= m) ++c;
}
return c;
}
auto bs = iota(uint.max).map!(m => calc(m)).assumeSorted;
writeln(bs.lowerBound((n+1)/2).length);
}
uint x = 0, y = 1, z = 2, w = 3;
void init(uint seed)
{
x = seed;
y = 1;
z = 2;
w = 3;
}
uint generate()
{
uint t = (x^(x<<11));
x = y;
y = z;
z = w;
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
return w;
}