結果
問題 | No.2538 2進元ゲーム |
ユーザー |
|
提出日時 | 2023-09-30 19:45:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 377 ms / 2,000 ms |
コード長 | 1,000 bytes |
コンパイル時間 | 271 ms |
コンパイル使用メモリ | 87,116 KB |
実行使用メモリ | 128,284 KB |
最終ジャッジ日時 | 2023-10-01 01:49:13 |
合計ジャッジ時間 | 8,234 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 143 ms
79,944 KB |
testcase_01 | AC | 138 ms
79,748 KB |
testcase_02 | AC | 139 ms
79,808 KB |
testcase_03 | AC | 137 ms
79,692 KB |
testcase_04 | AC | 136 ms
79,748 KB |
testcase_05 | AC | 141 ms
79,632 KB |
testcase_06 | AC | 139 ms
79,716 KB |
testcase_07 | AC | 140 ms
79,768 KB |
testcase_08 | AC | 140 ms
79,824 KB |
testcase_09 | AC | 138 ms
79,728 KB |
testcase_10 | AC | 142 ms
79,936 KB |
testcase_11 | AC | 138 ms
79,708 KB |
testcase_12 | AC | 138 ms
79,828 KB |
testcase_13 | AC | 138 ms
79,820 KB |
testcase_14 | AC | 137 ms
79,740 KB |
testcase_15 | AC | 141 ms
79,760 KB |
testcase_16 | AC | 140 ms
79,712 KB |
testcase_17 | AC | 141 ms
79,724 KB |
testcase_18 | AC | 138 ms
79,724 KB |
testcase_19 | AC | 139 ms
79,736 KB |
testcase_20 | AC | 139 ms
79,764 KB |
testcase_21 | AC | 140 ms
79,424 KB |
testcase_22 | AC | 140 ms
79,824 KB |
testcase_23 | AC | 142 ms
79,936 KB |
testcase_24 | AC | 139 ms
79,740 KB |
testcase_25 | AC | 140 ms
79,748 KB |
testcase_26 | AC | 138 ms
79,824 KB |
testcase_27 | AC | 145 ms
80,128 KB |
testcase_28 | AC | 151 ms
80,688 KB |
testcase_29 | AC | 154 ms
81,008 KB |
testcase_30 | AC | 173 ms
83,780 KB |
testcase_31 | AC | 315 ms
124,028 KB |
testcase_32 | AC | 363 ms
125,184 KB |
testcase_33 | AC | 371 ms
124,808 KB |
testcase_34 | AC | 263 ms
121,612 KB |
testcase_35 | AC | 377 ms
128,284 KB |
testcase_36 | AC | 263 ms
121,588 KB |
ソースコード
import re import sys content = input() pattern = r'^(\d+)$' result = re.match(pattern, content) if not result: sys.exit("format error.") n = int(content) if not (1 <= n and n <= 10**5): sys.exit("N") content = input() pattern = r'^(-?\d+)( (-?\d+))*$' result = re.match(pattern, content) if not result: sys.exit("format error.") a = list(map(int, content.split())) if len(a) != n: sys.exit("A") for i in range(n): if not (-(10**18) <= a[i] and a[i] <= 10**18): sys.exit("A") dp = {0 : 0} def get_nimber(a): global dp if a < 0: return 100 if a in dp: return dp[a] a0 = a ex = [0] * 10 for i in range(60): if a % 2 == 1: g = get_nimber(i) ex[g] = 1 a //= 2 for i in range(10): if ex[i] == 0: dp[a0] = i return i return -1 res = 0 for i in range(n): g = get_nimber(a[i]) res ^= g print(2 if res == 0 else 1)