結果

問題 No.1594 Three Classes
ユーザー Kiri8128Kiri8128
提出日時 2021-07-09 22:49:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 915 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 75,956 KB
最終ジャッジ日時 2024-04-28 00:31:55
合計ジャッジ時間 2,540 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
75,956 KB
testcase_01 AC 40 ms
51,840 KB
testcase_02 AC 39 ms
51,712 KB
testcase_03 AC 59 ms
67,584 KB
testcase_04 AC 104 ms
75,648 KB
testcase_05 AC 102 ms
75,740 KB
testcase_06 AC 46 ms
59,520 KB
testcase_07 AC 63 ms
68,352 KB
testcase_08 AC 105 ms
75,776 KB
testcase_09 AC 102 ms
75,648 KB
testcase_10 AC 102 ms
75,536 KB
testcase_11 AC 103 ms
75,648 KB
testcase_12 AC 102 ms
75,776 KB
testcase_13 AC 42 ms
52,608 KB
testcase_14 AC 63 ms
73,088 KB
testcase_15 AC 62 ms
71,808 KB
testcase_16 AC 61 ms
69,760 KB
testcase_17 AC 59 ms
67,200 KB
testcase_18 AC 40 ms
52,136 KB
testcase_19 AC 50 ms
61,568 KB
testcase_20 AC 58 ms
64,384 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