結果

問題 No.2124 Guess the Permutation
ユーザー とりゐとりゐ
提出日時 2022-10-20 16:21:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 92,996 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-09-12 21:21:39
合計ジャッジ時間 3,810 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
87,000 KB
testcase_01 AC 95 ms
87,036 KB
testcase_02 AC 95 ms
87,536 KB
testcase_03 AC 97 ms
87,340 KB
testcase_04 AC 98 ms
87,184 KB
testcase_05 AC 104 ms
87,192 KB
testcase_06 AC 142 ms
92,996 KB
testcase_07 AC 170 ms
92,400 KB
testcase_08 AC 167 ms
92,384 KB
testcase_09 AC 166 ms
92,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ask(l,r):
  print('?',l+1,r+1,flush=True)
  return int(input())

n=int(input())
ans=[0]*n
sm=n*(n+1)//2
for i in range(n-2):
  m=ask(i+1,n-1)
  ans[i]=sm-m
  sm=m

m=ask(0,n-2)
ans[-2]=m-sum(ans)
ans[-1]=n*(n+1)//2-sum(ans)
print('!',*ans)
exit()
0