結果

問題 No.1566 All Even
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-06-26 13:58:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 895 bytes
コンパイル時間 656 ms
コンパイル使用メモリ 87,364 KB
実行使用メモリ 71,732 KB
最終ジャッジ日時 2023-09-07 16:37:29
合計ジャッジ時間 3,890 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,124 KB
testcase_01 AC 73 ms
71,288 KB
testcase_02 WA -
testcase_03 AC 69 ms
71,260 KB
testcase_04 WA -
testcase_05 AC 70 ms
71,260 KB
testcase_06 WA -
testcase_07 AC 68 ms
71,680 KB
testcase_08 WA -
testcase_09 AC 71 ms
71,620 KB
testcase_10 AC 69 ms
71,256 KB
testcase_11 AC 69 ms
71,624 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 70 ms
71,464 KB
testcase_23 WA -
testcase_24 AC 69 ms
71,240 KB
testcase_25 WA -
testcase_26 AC 71 ms
71,164 KB
testcase_27 AC 70 ms
71,280 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

https://yukicoder.me/problems/no/1566

Nが非常に大きいので、算数で行けるはず
全ての2 x 2 で、1は偶数個である必要がる

11
11

101
010
101

111
111
111

000
111
000

"""

import sys
from sys import stdin

N,M = map(int,stdin.readline().split())

lis = [ [None,None] , [None,None] ]

ans = 1
for i in range(M):

    x,y,z = map(int,stdin.readline().split())

    if lis[x % 2][y % 2] == None:
        lis[x % 2][y % 2] = z
    elif lis[x % 2][y % 2] != z:
        print (0)
        sys.exit()


lis = lis[0] + lis[1]
ans = 0

for i in range(2**4):

    t1 = max(1,2**3 & i)
    t2 = max(1,2**2 & i)
    t3 = max(1,2**1 & i)
    t4 = max(1,2**0 & i)

    tlis = [t1,t2,t3,t4]

    if (t1+t2+t3+t4) % 2 == 1:
        continue
    
    for i in range(4):
        if lis[i] != None and tlis[i] != lis[i]:
            break
    else:
        ans += 1

print (ans)
0