結果
問題 | No.2496 LCM between Permutations |
ユーザー | KumaTachiRen |
提出日時 | 2023-09-12 16:05:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 282 ms / 2,000 ms |
コード長 | 839 bytes |
コンパイル時間 | 339 ms |
コンパイル使用メモリ | 86,676 KB |
実行使用メモリ | 93,764 KB |
平均クエリ数 | 952.76 |
最終ジャッジ日時 | 2023-09-12 16:05:22 |
合計ジャッジ時間 | 7,269 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 99 ms
87,140 KB |
testcase_01 | AC | 97 ms
87,204 KB |
testcase_02 | AC | 97 ms
86,880 KB |
testcase_03 | AC | 98 ms
87,080 KB |
testcase_04 | AC | 96 ms
86,928 KB |
testcase_05 | AC | 96 ms
87,020 KB |
testcase_06 | AC | 96 ms
87,240 KB |
testcase_07 | AC | 96 ms
87,564 KB |
testcase_08 | AC | 99 ms
87,256 KB |
testcase_09 | AC | 98 ms
87,420 KB |
testcase_10 | AC | 99 ms
87,080 KB |
testcase_11 | AC | 100 ms
86,648 KB |
testcase_12 | AC | 98 ms
86,944 KB |
testcase_13 | AC | 99 ms
86,860 KB |
testcase_14 | AC | 100 ms
87,176 KB |
testcase_15 | AC | 110 ms
87,172 KB |
testcase_16 | AC | 117 ms
91,072 KB |
testcase_17 | AC | 119 ms
91,060 KB |
testcase_18 | AC | 248 ms
93,260 KB |
testcase_19 | AC | 210 ms
93,064 KB |
testcase_20 | AC | 251 ms
93,108 KB |
testcase_21 | AC | 233 ms
93,652 KB |
testcase_22 | AC | 223 ms
93,764 KB |
testcase_23 | AC | 269 ms
93,492 KB |
testcase_24 | AC | 248 ms
93,404 KB |
testcase_25 | AC | 276 ms
93,384 KB |
testcase_26 | AC | 277 ms
93,440 KB |
testcase_27 | AC | 282 ms
93,500 KB |
testcase_28 | AC | 279 ms
93,212 KB |
ソースコード
def guess(i, j): print("?", i + 1, j + 1, flush=True) return int(input()) n = int(input()) if n == 1: print("!", 1, 1, flush=True) exit() p = n while True: ok = True d = 2 while d * d <= p: if p % d == 0: ok = False break d += (d & 1) + 1 if ok: break p -= 1 x, y = -1, -1 for i in range(n): if guess(i, i) % p == 0: if x == -1: x = i else: y = i if y > -1 and guess(x, y) % p != 0: x, y = y, x if y == -1: y = x a = [] for i in range(n): if i == x: a.append(p) else: a.append(guess(i, y) // p) b = [] for j in range(n): if j == y: b.append(p) else: b.append(guess(x, j) // p) print("!", " ".join(map(str, a)), " ".join(map(str, b)), flush=True)