結果
問題 | No.1152 10億ゲーム |
ユーザー | kimiyuki |
提出日時 | 2020-08-16 01:29:28 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,021 bytes |
コンパイル時間 | 72 ms |
コンパイル使用メモリ | 10,808 KB |
実行使用メモリ | 26,136 KB |
平均クエリ数 | 24.68 |
最終ジャッジ日時 | 2023-09-24 05:38:08 |
合計ジャッジ時間 | 6,871 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 84 ms
25,672 KB |
testcase_01 | AC | 78 ms
25,668 KB |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | AC | 81 ms
25,852 KB |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 82 ms
25,728 KB |
testcase_09 | AC | 81 ms
25,304 KB |
testcase_10 | AC | 82 ms
25,400 KB |
testcase_11 | AC | 81 ms
25,396 KB |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | AC | 82 ms
25,552 KB |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | AC | 82 ms
25,684 KB |
testcase_21 | AC | 79 ms
25,556 KB |
testcase_22 | AC | 80 ms
25,468 KB |
testcase_23 | AC | 82 ms
25,412 KB |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | AC | 79 ms
25,992 KB |
testcase_39 | AC | 80 ms
25,256 KB |
testcase_40 | AC | 82 ms
25,528 KB |
testcase_41 | AC | 83 ms
25,572 KB |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | AC | 81 ms
25,940 KB |
testcase_47 | AC | 82 ms
25,480 KB |
testcase_48 | AC | 80 ms
25,352 KB |
testcase_49 | AC | 81 ms
25,900 KB |
ソースコード
#!/usr/bin/env python3 import sys from typing import * def pack(x: int, y: int) -> int: return 2 ** x * 5 ** y def unpack(n: int) -> Tuple[int, int]: x, y = 0, 0 while n % 2 == 0: x += 1 n //= 2 while n % 5 == 0: y += 1 n //= 5 assert n == 1 return x, y H = 10 W = 10 def solve(a: int, b: int) -> int: ax, ay = unpack(a) bx, by = unpack(b) if abs(bx - ax) + abs(by - ay) == 1: ax = bx ay = by elif bx <= ax - 2: ax -= 1 elif bx >= ax + 2: ax += 1 elif by < ay: ay -= 1 elif by > ay: ay += 1 elif bx < ax: ax -= 1 elif bx > ax: ax += 1 else: assert False return pack(ax, ay) def main(): a, b = map(int, input().split()) while True: a = solve(a, b) print(a) sys.stdout.flush() if a == b: break b = int(input()) if a == b: break if __name__ == '__main__': main()