結果
| 問題 | No.3501 Digit Products 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 04:34:52 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 759 bytes |
| 記録 | |
| コンパイル時間 | 726 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 35,468 KB |
| 平均クエリ数 | 10.44 |
| 最終ジャッジ日時 | 2026-04-18 04:35:32 |
| 合計ジャッジ時間 | 15,363 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 43 WA * 29 |
ソースコード
import sys
input = sys.stdin.readline
N = int(input())
products = [0]*N
# ask queries
for i in range(1, N):
print(f"? 0 {i}", flush=True)
x = int(input())
if x == -1:
exit() # MUST exit immediately
products[i] = x
# try all possible d0
candidates = []
for d0 in range(1, 10):
digits = [0]*N
digits[0] = d0
ok = True
for i in range(1, N):
if products[i] % d0 != 0:
ok = False
break
digits[i] = products[i] // d0
if not (0 <= digits[i] <= 9):
ok = False
break
if ok:
candidates.append(digits)
# output
if len(candidates) == 1:
print(f"! {''.join(map(str, candidates[0]))}", flush=True)
else:
print("! -1", flush=True)