結果

問題 No.2828 Remainder Game
ユーザー miya145592miya145592
提出日時 2024-08-02 22:37:52
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 773 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 82,584 KB
実行使用メモリ 90,092 KB
平均クエリ数 49.30
最終ジャッジ日時 2024-08-02 22:37:57
合計ジャッジ時間 4,997 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 99 ms
68,704 KB
testcase_16 AC 102 ms
68,576 KB
testcase_17 AC 100 ms
68,064 KB
testcase_18 AC 104 ms
68,576 KB
testcase_19 AC 103 ms
69,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(l, r, m):
    if len(ans)==5:
        return 0
    used.add((l, r))
    k = r-l
    rr = []
    for i in range(l, r):
        rr.append(i)
    print(m, k, flush=True)
    print(*rr, flush=True)
    global cnt
    cnt += 1
    assert(cnt<30)
    c = int(input())
    if c==0:
        return 0
    if k==1:
        for _ in range(c):
            ans.append(l)
        return c
    # left
    if (l, (l+r)//2) not in used:
        ret = f(l, (l+r)//2, m)
    # right
    if c-ret>0:
        if ((l+r)//2, r) not in used:
            f((l+r)//2, r, m)
    return c
import sys
input = sys.stdin.readline
N = int(input())
l = 1
r = N+1
ans = []
cnt = 0
used = set()
# left
f(l, (l+r)//2, N+1)
# right
f((l+r)//2, r, N+1)
print(0, 1, flush=True)
print(sum(ans), flush=True)
0