結果

問題 No.2496 LCM between Permutations
ユーザー 👑 p-adicp-adic
提出日時 2023-09-05 14:39:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 285 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 1,392 ms
コンパイル使用メモリ 86,436 KB
実行使用メモリ 94,016 KB
平均クエリ数 952.76
最終ジャッジ日時 2023-09-06 09:43:56
合計ジャッジ時間 7,363 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
87,248 KB
testcase_01 AC 99 ms
86,960 KB
testcase_02 AC 97 ms
86,864 KB
testcase_03 AC 99 ms
87,420 KB
testcase_04 AC 100 ms
87,164 KB
testcase_05 AC 99 ms
87,164 KB
testcase_06 AC 99 ms
86,924 KB
testcase_07 AC 98 ms
87,032 KB
testcase_08 AC 101 ms
87,396 KB
testcase_09 AC 101 ms
87,560 KB
testcase_10 AC 101 ms
87,132 KB
testcase_11 AC 99 ms
87,124 KB
testcase_12 AC 99 ms
87,260 KB
testcase_13 AC 99 ms
87,504 KB
testcase_14 AC 100 ms
87,272 KB
testcase_15 AC 116 ms
91,148 KB
testcase_16 AC 117 ms
91,312 KB
testcase_17 AC 122 ms
91,972 KB
testcase_18 AC 252 ms
93,456 KB
testcase_19 AC 205 ms
93,100 KB
testcase_20 AC 258 ms
93,808 KB
testcase_21 AC 238 ms
93,196 KB
testcase_22 AC 227 ms
93,564 KB
testcase_23 AC 279 ms
94,016 KB
testcase_24 AC 251 ms
93,820 KB
testcase_25 AC 280 ms
93,544 KB
testcase_26 AC 280 ms
93,312 KB
testcase_27 AC 283 ms
93,428 KB
testcase_28 AC 285 ms
93,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

O,R=print,range
I=lambda:int(input())
N=I()
if N<2:O("! 1 1"),exit()
P=[1]*(N+1)
for i in R(2,N):
	if P[i]:
		for j in R(i+i,N+1,i):P[j]=0
for i in R(N,0,-1):
	if P[i]:
		P=i
		break
Q=[]
L=0
N=R(1,N+1)
for i in N:
	O("?",i,i)
	t=I()
	if t%P<1:Q,L=Q+[i],L+1
if L<2:Q+=[Q[0]]
else:
	O("?",*Q)
	t=I()
	if t%P:Q=Q[::-1]
A=[]
for n in R(2):
	A+=[[]]
	for i in N:
		if i==Q[n]:A[n]+=[P]
		else:
			O("?",[i,Q[0]][n],[Q[1],i][n])
			A[n]+=[I()//P]
O("!",*A[0],*A[1])
0