結果

問題 No.2496 LCM between Permutations
ユーザー mkawa2
提出日時 2023-10-06 22:43:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 393 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,120 KB
平均クエリ数 656.00
最終ジャッジ日時 2024-07-26 16:45:40
合計ジャッジ時間 6,507 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 RE * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache

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

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