結果

問題 No.2496 LCM between Permutations
ユーザー mkawa2mkawa2
提出日時 2023-10-06 22:43:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 393 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,752 KB
実行使用メモリ 25,348 KB
平均クエリ数 656.00
最終ジャッジ日時 2023-10-06 22:43:30
合計ジャッジ時間 6,025 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
24,724 KB
testcase_01 AC 45 ms
24,180 KB
testcase_02 AC 44 ms
24,412 KB
testcase_03 RE -
testcase_04 AC 44 ms
24,468 KB
testcase_05 AC 44 ms
24,228 KB
testcase_06 AC 45 ms
24,488 KB
testcase_07 RE -
testcase_08 AC 46 ms
24,400 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 45 ms
24,952 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 57 ms
24,476 KB
testcase_18 RE -
testcase_19 AC 113 ms
24,624 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 112 ms
24,764 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
権限があれば一括ダウンロードができます

ソースコード

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