結果
問題 |
No.702 中央値を求めよ LIMITED
|
ユーザー |
|
提出日時 | 2018-06-15 22:39:36 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 907 bytes |
コンパイル時間 | 779 ms |
コンパイル使用メモリ | 112,732 KB |
実行使用メモリ | 7,832 KB |
最終ジャッジ日時 | 2024-06-13 01:14:28 |
合計ジャッジ時間 | 6,011 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 15 WA * 10 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, std.bitmanip; uint x = 0, 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; } void main() { int N = 10000001; int M = N / 2 + 1; uint seed = readln.chomp.to!uint; x = seed; int less = 0; auto A = new int[](10^^6); uint hoge = 2147000000; foreach (_; 0..N) { uint a = generate(); if (a >= hoge && a < hoge + 10^^6) A[a - hoge] += 1; else if (a < hoge) less += 1; } foreach (i; 0..10^^6) { if (less + A[i] >= M) { writeln(hoge + i); return; } else { less += A[i]; } } }