結果
| 問題 | No.3590 I Love Inversions |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-07-18 03:00:43 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 2,391 ms / 5,000 ms |
| + 34µs | |
| コード長 | 512 bytes |
| 記録 | |
| コンパイル時間 | 236 ms |
| コンパイル使用メモリ | 96,620 KB |
| 実行使用メモリ | 90,880 KB |
| 平均クエリ数 | 12103.46 |
| 最終ジャッジ日時 | 2026-07-18 03:01:11 |
| 合計ジャッジ時間 | 27,783 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
import sys
input = sys.stdin.readline
n=int(input())
if n==1:
print("!",1,flush=True)
exit()
A=[]
for i in range(2,n+1):
print("?",1,i,flush=True)
ret=int(input())
A.append(ret)
LIST=list(range(1,n+1))
ANS=[]
for i in range(n-2,0,-1):
x=A[i]
y=A[i-1]
plus=x-y
xx=LIST.pop(-1-plus)
ANS.append(xx)
if A[0]>0:
ANS.append(LIST[0])
ANS.append(LIST[1])
else:
ANS.append(LIST[1])
ANS.append(LIST[0])
ANS.reverse()
print("!",*ANS,flush=True)
titia