結果

問題 No.2357 Guess the Function
ユーザー sepa38sepa38
提出日時 2023-06-23 21:51:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 1,000 ms
コード長 647 bytes
コンパイル時間 1,738 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 96,516 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-13 16:52:32
合計ジャッジ時間 3,962 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
96,388 KB
testcase_01 AC 209 ms
96,412 KB
testcase_02 AC 211 ms
95,728 KB
testcase_03 AC 208 ms
96,240 KB
testcase_04 AC 210 ms
96,180 KB
testcase_05 AC 209 ms
96,496 KB
testcase_06 AC 210 ms
96,400 KB
testcase_07 AC 211 ms
96,516 KB
testcase_08 AC 212 ms
96,480 KB
testcase_09 AC 212 ms
96,308 KB
testcase_10 AC 212 ms
96,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
for x1 in range(1, 101):
  flg = 0
  ls = [[] for _ in range(100)]
  for b in range(1, 101):
    for a in range(b):
      ls[(x1+a)%b].append([a, b])
  cnd = [0] * 100
  for i in range(100):
    for x2 in range(1, 101):
      s = set()
      for a, b in ls[i]:
        s.add((x2+a)%b)
      if len(s) == len(ls[i]):
        cnd[i] = x2
        break
    if cnd[i] == 0:
      flg = 1
      break
  if flg:
    continue
  else:
    print(f"? {x1}")
    sys.stdout.flush()
    y1 = int(input())
    print(f"? {cnd[y1]}")
    y2 = int(input())
    for a, b in ls[y1]:
      if (cnd[y1] + a) % b == y2:
        print(f"! {a} {b}")
    break
0