結果

問題 No.2124 Guess the Permutation
ユーザー KudeKude
提出日時 2022-11-18 21:38:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 84,296 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-20 06:25:11
合計ジャッジ時間 1,968 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
69,836 KB
testcase_01 AC 59 ms
69,836 KB
testcase_02 AC 59 ms
69,836 KB
testcase_03 AC 60 ms
69,836 KB
testcase_04 AC 66 ms
69,836 KB
testcase_05 AC 66 ms
69,836 KB
testcase_06 AC 95 ms
79,492 KB
testcase_07 AC 124 ms
84,296 KB
testcase_08 AC 124 ms
84,296 KB
testcase_09 AC 125 ms
84,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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