結果

問題 No.2124 Guess the Permutation
ユーザー dangodango
提出日時 2023-06-25 13:13:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 92,400 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-09-15 08:56:14
合計ジャッジ時間 2,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
87,072 KB
testcase_01 AC 95 ms
86,752 KB
testcase_02 AC 95 ms
86,996 KB
testcase_03 AC 95 ms
86,932 KB
testcase_04 AC 97 ms
86,760 KB
testcase_05 AC 101 ms
86,800 KB
testcase_06 AC 138 ms
92,232 KB
testcase_07 AC 162 ms
92,252 KB
testcase_08 AC 166 ms
92,340 KB
testcase_09 AC 165 ms
92,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
__sum__ = sum(range(1, N + 1))
ans = [0] * N
for i in range(N - 2):
    print(f"? {i + 2} {N}")
    A = int(input())
    ans[i] = __sum__ - A
    __sum__ = A
print(f"? 1 {N - 1}")
ans[N - 1] = sum(range(1, N + 1)) - int(input())
ans[N - 2] = __sum__ - ans[N - 1]
print("! ", end="")
for i in range(N):
    print(ans[i], end="")
    if i + 1 != N:
        print(" ", end="")
print()
0