結果

問題 No.702 中央値を求めよ LIMITED
ユーザー maspymaspy
提出日時 2020-01-06 13:01:03
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 773 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 76,420 KB
最終ジャッジ日時 2023-08-14 22:39:59
合計ジャッジ時間 21,565 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

seed = int(read())

def f(seed,pivot):
    x,y,z,w = seed,1,2,3
    cnt = 0
    max_w = 0
    mask = (1 << 32) - 1
    for _ in range(10 ** 7 + 1):
        t = x^((x<<11)&mask)
        x = y; y = z; z = w
        w = (w^(w>>19)) ^ (t^(t>>8))
        if w <= pivot:
            if max_w < w:
                max_w = w
            cnt += 1
    return cnt - 5000001, max_w

left = 0; fl = -500001
right = 1 << 32; fr = 500000
while True:
    x = int(left + (right - left) * (-fl) / (fr - fl)) + 1
    fx, w = f(seed,x)
    if fx == 0:
        answer = w
        break
    if fx > 0:
        right = w; fr = fx
    else:
        left = x; fl = fx
print(answer)
0