結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
86,920 KB
testcase_01 AC 96 ms
86,864 KB
testcase_02 AC 94 ms
86,748 KB
testcase_03 AC 96 ms
86,928 KB
testcase_04 AC 98 ms
86,980 KB
testcase_05 AC 102 ms
86,980 KB
testcase_06 AC 165 ms
92,060 KB
testcase_07 AC 164 ms
92,172 KB
testcase_08 AC 164 ms
91,940 KB
testcase_09 AC 167 ms
91,980 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] = (1 + N) * N // 2 - 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