結果

問題 No.2124 Guess the Permutation
ユーザー u_kunu_kun
提出日時 2022-11-18 21:39:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 84,336 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-20 06:25:22
合計ジャッジ時間 2,074 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

N = int(input())
all_sum = (N * (1 + N)) // 2

P = []
ever_sum = 0

for l in range(2, N):
    print(f"? {l} {N}")
    kukanwa = int(input())
    P.append(all_sum - kukanwa - ever_sum)
    ever_sum += P[-1]

print(f"? {1} {N - 1}")
kukanwa = int(input())
P.append(all_sum - kukanwa)    

for i in range(1, N + 1):
    if i not in P:
        P.insert(-1, i)

print("!" , *P)    
0