結果

問題 No.702 中央値を求めよ LIMITED
ユーザー bal4ubal4u
提出日時 2019-05-05 18:49:41
言語 C
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 668 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 28,508 KB
実行使用メモリ 5,832 KB
最終ジャッジ日時 2023-09-11 02:03:49
合計ジャッジ時間 3,914 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
5,732 KB
testcase_01 AC 69 ms
5,744 KB
testcase_02 AC 68 ms
5,784 KB
testcase_03 AC 68 ms
5,812 KB
testcase_04 AC 67 ms
5,684 KB
testcase_05 AC 68 ms
5,684 KB
testcase_06 AC 68 ms
5,820 KB
testcase_07 AC 69 ms
5,744 KB
testcase_08 AC 69 ms
5,620 KB
testcase_09 AC 68 ms
5,812 KB
testcase_10 AC 69 ms
5,692 KB
testcase_11 AC 69 ms
5,732 KB
testcase_12 AC 70 ms
5,752 KB
testcase_13 AC 68 ms
5,812 KB
testcase_14 AC 69 ms
5,744 KB
testcase_15 AC 68 ms
5,632 KB
testcase_16 AC 69 ms
5,816 KB
testcase_17 AC 68 ms
5,820 KB
testcase_18 AC 68 ms
5,832 KB
testcase_19 AC 68 ms
5,756 KB
testcase_20 AC 69 ms
5,732 KB
testcase_21 AC 68 ms
5,628 KB
testcase_22 AC 68 ms
5,684 KB
testcase_23 AC 68 ms
5,688 KB
testcase_24 WA -
testcase_25 RE -
testcase_26 AC 69 ms
5,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 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;
}
0