結果
| 問題 | No.3521 接線の傾き |
| コンテスト | |
| ユーザー |
zawakasu
|
| 提出日時 | 2026-05-01 23:36:11 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,193 bytes |
| 記録 | |
| コンパイル時間 | 872 ms |
| コンパイル使用メモリ | 20,712 KB |
| 実行使用メモリ | 40,664 KB |
| 平均クエリ数 | 9.45 |
| 最終ジャッジ日時 | 2026-05-01 23:36:20 |
| 合計ジャッジ時間 | 8,094 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 RE * 11 |
ソースコード
import math
import sys
class Item:
def __init__(self, value=0, coefs=None):
self.value = value
self.coefs = coefs if coefs is not None else []
D = int(input())
if D == 0:
print("! 0", flush=True)
sys.exit(0)
F = []
for n in range(1, 11):
print(f"? {n}", flush=True)
value = int(input())
coefs = []
coef = 1
for i in range(D + 1):
coefs.append(coef)
coef *= n
F.append(Item(value, coefs))
for i in range(D, 1, -1):
nxt = []
for j in range(len(F)):
for k in range(j + 1, len(F)):
L = math.lcm(F[j].coefs[i], F[k].coefs[i])
a = L // F[j].coefs[i]
b = L // F[k].coefs[i]
value = a * F[j].value - b * F[k].value
coefs = [
a * F[j].coefs[n] - b * F[k].coefs[n]
for n in range(D + 1)
]
nxt.append(Item(value, coefs))
nxt = nxt[:10]
F = nxt
L = math.lcm(F[0].coefs[0], F[1].coefs[0])
a = L // F[0].coefs[0]
b = L // F[1].coefs[0]
val = a * F[0].value - b * F[1].value
coef = a * F[0].coefs[1] - b * F[1].coefs[1]
assert coef != 0
val //= coef
print(f"! {val}", flush=True)
zawakasu