結果

問題 No.3501 Digit Products 2
コンテスト
ユーザー uselessman
提出日時 2026-04-18 17:40:33
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 811 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,535 ms
コンパイル使用メモリ 80,640 KB
実行使用メモリ 55,040 KB
平均クエリ数 10.89
最終ジャッジ日時 2026-09-08 17:38:16
合計ジャッジ時間 7,255 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 68 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import math
n = int(input())
a = [0 for _ in range(n)]
c0 = 0
for i in range(n-1):
	print('? '+str(i)+' '+str(n-1),flush = True)
	x = int(input())
	a[i] = x
	if x == 0:
		c0 += 1
if n-1-c0 == 0:
	print('! -1',flush = True)
	exit()
if n-1-c0 == 1:
	for i in range(n-1):
		if a[i] != 0:
			break
	if not ((a[i] == 1 or a[i] > 16) and math.isqrt(a[i])**2 == a[i]):
		print('! -1',flush = True)
		exit()
	a[n-1] = math.isqrt(a[i])
	a[i] = math.isqrt(a[i])
	ans = ''.join(map(str,a[::-1]))
	print('! '+ans,flush = True)
	exit()
t = []
for i in range(n-1):
	if a[i] != 0:
		t.append(i)
		if len(t) == 2:
			break
print('? '+str(t[0])+' '+str(t[1]),flush = True)
x = int(input())
a[n-1] = math.isqrt(a[t[0]]*a[t[1]]//x)
for i in range(n-1):
	a[i] //= a[n-1]
ans = ''.join(map(str,a[::-1]))
print('! '+ans,flush = True)
0