結果
| 問題 | No.3501 Digit Products 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-17 21:29:47 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,145 bytes |
| 記録 | |
| コンパイル時間 | 200 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 87,712 KB |
| 平均クエリ数 | 3.30 |
| 最終ジャッジ日時 | 2026-04-17 21:30:10 |
| 合計ジャッジ時間 | 17,468 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | AC * 9 WA * 42 RE * 21 |
ソースコード
# snippet: interactive_
# Last Modified: 2026-02-13
from collections import deque, defaultdict
from itertools import permutations, product
from bisect import bisect_left, bisect_right
from heapq import heappush, heappop
from random import randint, shuffle
def II(): return int(input())
def LI(): return list(map(int,input().split()))
def LI_1(): return [int(x) - 1 for x in input().split()]
def SI(): return input()
def LS(): return list(input().split())
mod = 998244353
inf = 1<<61
EPS = 10 ** -6
import sys
LOCAL = sys.stdin.isatty()
# snippet: isqrt_
# Last Modified: 2026-02-12
from math import sqrt
def isqrt(x):
y = int(sqrt(x))
while (y + 1) * (y + 1) <= x:
y += 1
while y * y > x:
y -= 1
return y
N = 3
X = "770"
A = [int(c) for c in X[::-1]]
if LOCAL:
def ask(*arg):
debug(*arg)
if arg[0] == "?":
_, a, b = arg
debug(A[a] * A[b])
return A[a] * A[b]
_, x = arg
if x == X or x == "-1":
print("AC")
else:
print("WA")
print(X)
print(x)
return
else:
def ask(*arg):
print(*arg, flush=True)
if arg[0] == "?": return II()
return
def debug(*arg):
if LOCAL:
print(*arg, file=sys.stderr)
def solve():
# N = II()
li = [0] * N
not_zero = []
for i in range(N - 1):
li[i] = ask("?", i, N - 1)
if li[i] != 0: not_zero.append((i, li[i]))
if sum(li) == 0:
ask("!", "-1")
elif len(not_zero) == 1:
i, x = not_zero[-1]
if x == 1 or x == 25 or x == 49 or x == 64 or x == 81:
y = isqrt(x)
li[-1] = y
li[i] = y
ask("!", "".join(map(str, li[::-1])))
else:
ask("!", "-1")
else:
i, x = not_zero[-1]
j, y = not_zero[-2]
ij = ask("?", i, j)
a0 = isqrt(x * y // ij)
for i in range(N):
li[i] //= a0
li[-1] = a0
ask("!", "".join(map(str, li[::-1])))
return
if __name__ == "__main__":
T = 1
# T = II()
for _ in range(T):
solve()