結果

問題 No.2538 2進元ゲーム
コンテスト
ユーザー rlangevin
提出日時 2023-11-10 23:11:52
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 732 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 201 ms
コンパイル使用メモリ 85,376 KB
実行使用メモリ 102,272 KB
最終ジャッジ日時 2026-04-13 04:49:53
合計ジャッジ時間 3,227 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
A = list(map(int, input().split()))
cnt1, cnt2 = 0, 0
for a in A:
    if a < 0:
        if a % 2:
            cnt1 += 1
        else:
            cnt2 += 1
if cnt1 or cnt2:
    if cnt1 % 2:
        print(1)
    elif cnt2 % 2 == 0:
        print(1)
    else:
        print(2)
    exit()

    
M = 65
dp = [-1] * M
dp[0] = 0
for i in range(M):
    S = set()
    for j in range(10):
        if (i >> j) & 1:
            S.add(dp[j])
    now = 0
    while now in S:
        now += 1
    dp[i] = now
    
ans = 0
for i in range(N):
    S = set()
    for j in range(M):
        if (A[i] >> j) & 1:
            S.add(dp[j])
    now = 0
    while now in S:
        now += 1
    ans ^= now
    
print(1) if ans else print(2)
0