結果

問題 No.1717 Levi-Civita Triangle
ユーザー ああいいああいい
提出日時 2022-06-01 14:06:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 457 ms / 2,000 ms
コード長 635 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 131,660 KB
最終ジャッジ日時 2023-10-21 00:49:22
合計ジャッジ時間 10,212 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,520 KB
testcase_01 AC 36 ms
53,520 KB
testcase_02 AC 36 ms
53,520 KB
testcase_03 AC 36 ms
53,520 KB
testcase_04 AC 39 ms
58,840 KB
testcase_05 AC 53 ms
70,536 KB
testcase_06 AC 83 ms
78,120 KB
testcase_07 AC 240 ms
108,016 KB
testcase_08 AC 36 ms
53,520 KB
testcase_09 AC 35 ms
53,520 KB
testcase_10 AC 52 ms
72,584 KB
testcase_11 AC 77 ms
76,976 KB
testcase_12 AC 155 ms
92,240 KB
testcase_13 AC 36 ms
53,520 KB
testcase_14 AC 42 ms
59,724 KB
testcase_15 AC 45 ms
66,096 KB
testcase_16 AC 80 ms
75,912 KB
testcase_17 AC 352 ms
115,524 KB
testcase_18 AC 37 ms
53,520 KB
testcase_19 AC 44 ms
62,000 KB
testcase_20 AC 45 ms
64,048 KB
testcase_21 AC 80 ms
75,800 KB
testcase_22 AC 263 ms
101,504 KB
testcase_23 AC 38 ms
53,520 KB
testcase_24 AC 45 ms
62,000 KB
testcase_25 AC 56 ms
72,600 KB
testcase_26 AC 62 ms
75,636 KB
testcase_27 AC 130 ms
85,328 KB
testcase_28 AC 37 ms
53,520 KB
testcase_29 AC 42 ms
61,980 KB
testcase_30 AC 55 ms
72,584 KB
testcase_31 AC 71 ms
75,752 KB
testcase_32 AC 353 ms
117,344 KB
testcase_33 AC 457 ms
131,656 KB
testcase_34 AC 451 ms
129,576 KB
testcase_35 AC 446 ms
131,656 KB
testcase_36 AC 443 ms
129,576 KB
testcase_37 AC 455 ms
131,656 KB
testcase_38 AC 428 ms
129,576 KB
testcase_39 AC 438 ms
129,576 KB
testcase_40 AC 435 ms
131,660 KB
testcase_41 AC 444 ms
129,576 KB
testcase_42 AC 435 ms
131,656 KB
testcase_43 AC 441 ms
129,576 KB
testcase_44 AC 440 ms
131,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))

s1 = {(0,1,2),(1,2,0),(2,0,1)}
s2 = {(2,1,0),(1,0,2),(0,2,1)}

import sys
def calc(l):
    n = len(l)
    ans = []
    for i in range(1,n - 1):
        if (l[i-1],l[i],l[i+1]) in s1:
            ans.append(1)
        elif (l[i-1],l[i],l[i+1]) in s2:
            ans.append(2)
        else:
            ans.append(0)
    return ans
if N <= 20:
    for _ in range(N):
        A = calc(A)
    print(A[0])
    exit()
else:
    for _ in range(15):
        A = calc(A)
    n = len(A) //2
    if A[n-1] == 0 and A[n] == 0 and A[n + 1] == 0:
        print(0)
    else:
        print(A[-1])
0