結果
| 問題 |
No.3246 80% Accuracy Calculator
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-09-02 06:28:30 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 471 ms / 2,000 ms |
| コード長 | 4,016 bytes |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 28,152 KB |
| 平均クエリ数 | 2954.70 |
| 最終ジャッジ日時 | 2025-09-02 06:28:43 |
| 合計ジャッジ時間 | 12,061 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
import sys
input = sys.stdin.readline
from collections import Counter
A=[]
for i in range(10):
print("?","A",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
A.append(ret)
B=[]
for i in range(10):
print("?","B",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
B.append(ret)
CA=Counter(A)
A0=CA.most_common()[0][0]
CB=Counter(B)
B0=CB.most_common()[0][0]
while True:
print("+","C","C","A",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
A=[]
for i in range(6):
print("?","A",flush=True)
print(ret, file=sys.stderr, flush=True)
ret=int(input())
A.append(ret)
if ret!=0:
break
CA=Counter(A)
A=CA.most_common()[0][0]
if CA.most_common()[0][1]>=6 and A==0:
break
count=0
NOW=[0,B0,0]
X=[0,B0]
while X[-1]!=A0*B0:
if X[-1]+X[-1]<=A0*B0:
X.append(X[-1]*2)
else:
X.append(X[-1]+B0)
for i in range(1,len(X)):
if (len(X)-i)%2==1:
if X[i]==X[i-1]+B0:
while True:
print("+","A","B","C",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
C=[]
for i in range(6):
print("?","C",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
C.append(ret)
if ret!=NOW[0]+NOW[1]:
break
CC=Counter(C)
C=CC.most_common()[0][0]
if CC.most_common()[0][1]>=6 and C==NOW[0]+NOW[1]:
NOW[2]=NOW[0]+NOW[1]
count+=1
break
else:
while True:
print("+","A","A","C",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
C=[]
for i in range(6):
print("?","C",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
C.append(ret)
if ret!=NOW[0]+NOW[0]:
break
CC=Counter(C)
C=CC.most_common()[0][0]
if CC.most_common()[0][1]>=6 and C==NOW[0]+NOW[0]:
NOW[2]=NOW[0]+NOW[0]
count+=1
break
else:
if X[i]==X[i-1]+B0:
while True:
print("+","C","B","A",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
C=[]
for i in range(6):
print("?","A",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
C.append(ret)
if ret!=NOW[1]+NOW[2]:
break
CC=Counter(C)
C=CC.most_common()[0][0]
if CC.most_common()[0][1]>=6 and C==NOW[1]+NOW[2]:
NOW[0]=NOW[1]+NOW[2]
count+=1
break
else:
while True:
print("+","C","C","A",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
C=[]
for i in range(6):
print("?","A",flush=True)
ret=int(input())
print(ret, file=sys.stderr, flush=True)
C.append(ret)
if ret!=NOW[2]+NOW[2]:
break
CC=Counter(C)
C=CC.most_common()[0][0]
if CC.most_common()[0][1]>=6 and C==NOW[2]+NOW[2]:
NOW[0]=NOW[2]+NOW[2]
count+=1
break
print("!","C",flush=True)
titia