結果
| 問題 | No.702 中央値を求めよ LIMITED |
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-05-05 18:49:41 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 668 bytes |
| 記録 | |
| コンパイル時間 | 295 ms |
| コンパイル使用メモリ | 29,568 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 16:35:21 |
| 合計ジャッジ時間 | 2,943 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 WA * 1 RE * 1 |
ソースコード
// yukicoder: No. 702 中央値を求めよ LIMITED
// 2019.5.5 bal4u
#include <stdio.h>
unsigned x = 0, y = 1, z = 2, w = 3;
unsigned generate() {
unsigned t = x^(x<<11);
x = y, y = z, z = w;
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
return w;
}
#define SIZE 10000001
#define UPPER 2150000000U
#define LOWER 2146000000U
char a[UPPER-LOWER+10];
int main()
{
int i, cnt;
unsigned k;
scanf("%u", &x);
cnt = 0;
i = SIZE; while (i--) {
k = generate();
if (k <= LOWER) cnt++;
else if (k < UPPER) a[k - LOWER]++;
}
cnt = (SIZE >> 1)-cnt;
i = 0; while (cnt >= 0) {
if (a[++i]) cnt -= a[i];
}
printf("%u\n", LOWER + i);
return 0;
}
bal4u