結果

問題 No.1717 Levi-Civita Triangle
ユーザー hari64hari64
提出日時 2021-10-22 23:10:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,354 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 12,048 KB
実行使用メモリ 12,432 KB
最終ジャッジ日時 2023-10-24 15:09:55
合計ジャッジ時間 9,943 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,252 KB
testcase_01 AC 28 ms
10,252 KB
testcase_02 AC 27 ms
10,252 KB
testcase_03 AC 27 ms
10,252 KB
testcase_04 AC 28 ms
10,252 KB
testcase_05 AC 55 ms
10,276 KB
testcase_06 AC 429 ms
10,640 KB
testcase_07 TLE -
testcase_08 AC 28 ms
10,252 KB
testcase_09 AC 27 ms
10,252 KB
testcase_10 AC 67 ms
10,280 KB
testcase_11 AC 393 ms
10,488 KB
testcase_12 AC 1,532 ms
11,416 KB
testcase_13 AC 28 ms
10,252 KB
testcase_14 AC 29 ms
10,252 KB
testcase_15 AC 49 ms
10,272 KB
testcase_16 AC 331 ms
10,460 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
As = list(map(int, input().split()))
cnt = 0
while len(As) >= 3 and cnt <= 30:
    cnt += 1
    Bs = [None]*(len(As)-2)
    for i in range(1, len(As)-1):
        if (As[i - 1] == 0 and As[i] == 1 and As[i + 1] == 2):
            Bs[i - 1] = 1
        elif (As[i - 1] == 1 and As[i] == 2 and As[i + 1] == 0):
            Bs[i - 1] = 1
        elif (As[i - 1] == 2 and As[i] == 0 and As[i + 1] == 1):
            Bs[i - 1] = 1
        elif (As[i - 1] == 2 and As[i] == 1 and As[i + 1] == 0):
            Bs[i - 1] = 2
        elif (As[i - 1] == 1 and As[i] == 0 and As[i + 1] == 2):
            Bs[i - 1] = 2
        elif (As[i - 1] == 0 and As[i] == 2 and As[i + 1] == 1):
            Bs[i - 1] = 2
        else:
            Bs[i - 1] = 0
    As = Bs
    # print(As)

if (len(As) == 1):
    print(As[0])
    exit()

if all(i == 0 for i in As[1::2]):
    if all(i == 2 for i in As[::4]) and all(i == 1 for i in As[2::4]) and len(As) % 4 == 3:
        print(1)
    elif all(i == 1 for i in As[::4]) and all(i == 2 for i in As[2::4]) and len(As) % 4 == 1:
        print(1)
    elif all(i == 2 for i in As[::4]) and all(i == 1 for i in As[2::4]) and len(As) % 4 == 1:
        print(2)
    elif all(i == 1 for i in As[::4]) and all(i == 2 for i in As[2::4]) and len(As) % 4 == 3:
        print(2)
    else:
        print(0)
else:
    print(0)
0