結果

問題 No.2124 Guess the Permutation
コンテスト
ユーザー Kude
提出日時 2022-11-18 21:38:54
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 310 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 224 ms
コンパイル使用メモリ 84,908 KB
実行使用メモリ 88,424 KB
平均クエリ数 374.60
最終ジャッジ日時 2026-04-08 14:32:35
合計ジャッジ時間 1,940 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def ask(l, r):
    print(f'? {l + 1} {r}')
    return int(input())

def answer(d):
    print('!', *d)

n = int(input())
ans = [0] * n
tot = n * (n + 1) // 2
rest = tot
for i in range(2, n)[::-1]:
    ans[i] = rest - ask(0, i)
    rest -= ans[i]
ans[0] = tot - ask(1, n)
rest -= ans[0]
ans[1] = rest
answer(ans)
0