結果

問題 No.1717 Levi-Civita Triangle
ユーザー hir355hir355
提出日時 2021-10-22 22:58:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 81,724 KB
実行使用メモリ 102,116 KB
最終ジャッジ日時 2023-10-24 14:29:47
合計ジャッジ時間 4,252 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,456 KB
testcase_01 AC 36 ms
53,456 KB
testcase_02 AC 35 ms
53,456 KB
testcase_03 AC 35 ms
53,456 KB
testcase_04 AC 36 ms
53,456 KB
testcase_05 AC 42 ms
59,976 KB
testcase_06 AC 50 ms
67,048 KB
testcase_07 AC 74 ms
87,880 KB
testcase_08 AC 36 ms
53,456 KB
testcase_09 AC 36 ms
53,456 KB
testcase_10 AC 44 ms
60,004 KB
testcase_11 AC 51 ms
68,672 KB
testcase_12 AC 59 ms
77,120 KB
testcase_13 AC 35 ms
53,456 KB
testcase_14 AC 35 ms
53,456 KB
testcase_15 AC 37 ms
53,456 KB
testcase_16 AC 49 ms
66,332 KB
testcase_17 AC 73 ms
93,212 KB
testcase_18 AC 35 ms
53,456 KB
testcase_19 AC 35 ms
53,456 KB
testcase_20 AC 37 ms
53,456 KB
testcase_21 AC 49 ms
66,332 KB
testcase_22 AC 65 ms
85,860 KB
testcase_23 AC 35 ms
53,456 KB
testcase_24 AC 35 ms
53,456 KB
testcase_25 AC 43 ms
62,192 KB
testcase_26 AC 47 ms
64,284 KB
testcase_27 AC 58 ms
72,876 KB
testcase_28 AC 35 ms
53,456 KB
testcase_29 AC 36 ms
53,456 KB
testcase_30 AC 43 ms
62,184 KB
testcase_31 AC 49 ms
64,284 KB
testcase_32 AC 75 ms
95,480 KB
testcase_33 AC 82 ms
102,116 KB
testcase_34 AC 81 ms
102,116 KB
testcase_35 AC 83 ms
102,116 KB
testcase_36 AC 83 ms
102,116 KB
testcase_37 AC 81 ms
102,116 KB
testcase_38 AC 82 ms
102,116 KB
testcase_39 AC 84 ms
102,116 KB
testcase_40 AC 83 ms
102,116 KB
testcase_41 AC 81 ms
102,116 KB
testcase_42 AC 81 ms
102,116 KB
testcase_43 AC 83 ms
102,116 KB
testcase_44 AC 81 ms
102,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = [0] * (2 * n - 1)
for i in range(2 * n - 1):
    if (a[i] + 1) % 3 == a[i + 1] and (a[i + 1] + 1) % 3 == a[i + 2]:
        b[i] = 1
    elif (a[i] - 1) % 3 == a[i + 1] and (a[i + 1] - 1) % 3 == a[i + 2]:
        b[i] = 2
n -= 1
for i in range(n):
    if b[i * 2 + 1] != 0:
        print(0)
        exit(0)
    if b[i * 2] == 0 or b[i * 2 + 2] == 0 or b[i * 2] == b[i * 2 + 2]:
        print(0)
        exit(0)
else:
    if (b[0] == 1) ^ (n & 1):
        print(1)
    else:
        print(2)
0