結果

問題 No.2124 Guess the Permutation
ユーザー ninja-kidninja-kid
提出日時 2022-11-28 16:35:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 376 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,156 KB
実行使用メモリ 85,204 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-04-15 15:57:47
合計ジャッジ時間 2,317 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
base = (N + 1) * N // 2
ans = []

def check(l, r):
    print(f"? {l} {r}", flush=True)
    ret = int(input())
    return ret
    
first2 = check(2, N)
first = base - first2
for r in range(N - 1, 1, -1):
    res = check(1, r)
    val = base - res
    ans.append(str(val))
    base = res
ans.append(str(first))
result = ' '.join(ans[::-1])
print(f"! {result}")
0