結果

問題 No.2124 Guess the Permutation
ユーザー miya145592miya145592
提出日時 2023-05-04 06:40:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 85,208 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-05-01 19:56:01
合計ジャッジ時間 1,855 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
68,320 KB
testcase_01 AC 51 ms
68,952 KB
testcase_02 AC 51 ms
68,440 KB
testcase_03 AC 52 ms
68,696 KB
testcase_04 AC 57 ms
68,952 KB
testcase_05 AC 61 ms
69,592 KB
testcase_06 AC 91 ms
78,936 KB
testcase_07 AC 121 ms
85,208 KB
testcase_08 AC 123 ms
84,696 KB
testcase_09 AC 121 ms
84,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = [0 for _ in range(N+1)]
S[N] = N*(N+1)//2
C = [0 for _ in range((N))]
for i in range(N-1):
    if i==N-2:
        print(f"? 2 {N}", flush=True)
        s = int(input())
        S[1] = S[N]-s
        C[0] = S[1]-S[0]
    else:
        print(f"? 1 {N-1-i}", flush=True)
        s = int(input())
        S[N-1-i] = s
        C[N-1-i] = S[N-i]-S[N-1-i]
C[1] = S[2]-S[1]
print("!", *C, flush=True)
0