結果

問題 No.1594 Three Classes
ユーザー Kiri8128Kiri8128
提出日時 2021-07-09 22:49:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 915 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 76,916 KB
最終ジャッジ日時 2023-08-10 06:54:37
合計ジャッジ時間 3,471 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
76,828 KB
testcase_01 AC 68 ms
71,364 KB
testcase_02 AC 66 ms
71,372 KB
testcase_03 AC 85 ms
76,408 KB
testcase_04 AC 132 ms
76,876 KB
testcase_05 AC 127 ms
76,916 KB
testcase_06 AC 74 ms
76,296 KB
testcase_07 AC 90 ms
76,368 KB
testcase_08 AC 127 ms
76,804 KB
testcase_09 AC 122 ms
76,908 KB
testcase_10 AC 125 ms
76,780 KB
testcase_11 AC 128 ms
76,820 KB
testcase_12 AC 127 ms
76,788 KB
testcase_13 AC 67 ms
71,372 KB
testcase_14 AC 93 ms
76,712 KB
testcase_15 AC 94 ms
76,308 KB
testcase_16 AC 96 ms
76,388 KB
testcase_17 AC 85 ms
76,316 KB
testcase_18 AC 71 ms
71,176 KB
testcase_19 AC 81 ms
76,248 KB
testcase_20 AC 86 ms
76,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# D
def chk(i):
    # NG のとき 1 を返す
    return 0

N = int(input())
E = [int(a) for a in input().split()]
K = N
Z = [0] * K
R = [0] * K
Z[0], R[0] = 0, 3 # 半開区間 [Start, End)
i = 0
cnt = 0 # Debug 用
while i >= 0:
    ng = 0
    while i < K - 1:
        i += 1
        Z[i] = 0 # Start
        R[i] = 3 # End
        if chk(i):
            ng = 1
            break
    
    if not ng:
        ### ここに処理を書く
        # if cnt < 30:
        #     print("Z =", cnt, Z)
        P = [0] * 3
        cnt += 1
        for i, z in enumerate(Z):
            P[z] += E[i]
        if P[0] == P[1] == P[2]:
            print("Yes")
            exit()
        ###
    
    Z[i] += 1
    while Z[i] >= R[i] or chk(i):
        if Z[i] < R[i]: Z[i] += 1
        while Z[i] >= R[i]:
            i -= 1
            if i < 0: break
            Z[i] += 1
        if i < 0: break
# print(cnt)
print("No")
0