結果

問題 No.2496 LCM between Permutations
コンテスト
ユーザー mkawa2
提出日時 2023-10-06 22:42:28
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 362 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 599 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 40,788 KB
平均クエリ数 656.00
最終ジャッジ日時 2026-04-03 17:39:06
合計ジャッジ時間 9,339 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 RE * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from functools import lru_cache

@lru_cache(None)
def ask(i, j):
    print("?", i+1, j+1, flush=True)
    return int(input())

n = int(input())
mn, i1 = 10**9, -1
for i in range(n):
    x = ask(i, 0)
    if x < mn: mn, i1 = x, i

bb=[0]*n
for j in range(n):bb[j]=ask(i1,j)
j1=bb.index(1)
aa=[0]*n
for i in range(n):aa[i]=ask(i,j1)

print("!",*aa,*bb,flush=True)
0