結果

問題 No.2124 Guess the Permutation
コンテスト
ユーザー koheijkt
提出日時 2026-04-09 18:55:43
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 428 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 109 ms
コンパイル使用メモリ 85,452 KB
実行使用メモリ 91,588 KB
平均クエリ数 374.60
最終ジャッジ日時 2026-04-09 18:55:46
合計ジャッジ時間 1,900 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
ans = [0] * (N + 1)
total = N*(N + 1)//2

# 末尾のみ特定
print('?', 1, N - 1, flush=True)
res = int(input())
ans[N] = total - res

rui = 0
for i in range(2, N):
    # ターンi は i-1 の答えが分かる

    print('?', i, N, flush=True)
    res = int(input())
    ans[i - 1] = total - res - rui
    rui += ans[i - 1]

# N - 1 を特定
ans[N - 1] = total - sum(ans)

print('!', *ans[1:], flush=True)
0