結果

問題 No.1594 Three Classes
ユーザー moharan627moharan627
提出日時 2021-07-09 21:48:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 1,056 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 76,912 KB
最終ジャッジ日時 2023-08-10 06:49:44
合計ジャッジ時間 4,422 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
76,912 KB
testcase_01 AC 70 ms
71,348 KB
testcase_02 AC 71 ms
71,472 KB
testcase_03 AC 174 ms
76,748 KB
testcase_04 AC 174 ms
76,784 KB
testcase_05 AC 174 ms
76,540 KB
testcase_06 AC 176 ms
76,568 KB
testcase_07 AC 176 ms
76,904 KB
testcase_08 AC 173 ms
76,836 KB
testcase_09 AC 173 ms
76,724 KB
testcase_10 AC 170 ms
76,888 KB
testcase_11 AC 174 ms
76,860 KB
testcase_12 AC 172 ms
76,616 KB
testcase_13 AC 79 ms
76,304 KB
testcase_14 AC 174 ms
76,680 KB
testcase_15 AC 175 ms
76,832 KB
testcase_16 AC 112 ms
76,728 KB
testcase_17 AC 175 ms
76,748 KB
testcase_18 AC 73 ms
75,824 KB
testcase_19 AC 81 ms
76,340 KB
testcase_20 AC 84 ms
76,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
INF = float('inf')
#10**20,2**63,float('inf')
MOD = 10**9 + 7
MOD2 = 998244353
#from collections import defaultdict
def solve():
    def II(): return int(sys.stdin.readline())
    def LI(): return list(map(int, sys.stdin.readline().split()))
    def LC(): return list(input())
    def IC(): return [int(c) for c in input()]
    def MI(): return map(int, sys.stdin.readline().split())
    N = II()
    E = LI()
    flag = False
    for bit3 in range(3**N):
        P = [0] * 3
        Label = []
        # 10進から8進へ
        if (bit3 == 0):
            Label.append(0)
        while bit3:
            bit3, R = divmod(bit3, 3)
            Label.append(R)

        if(len(Label)<N):
            Label = [0]*(N-len(Label))+Label
        #print(Label)
        for i,l in enumerate(Label):
            P[l] += E[i]
        if(P[0] == P[1] == P[2]):
            flag = True
    if flag:
        print("Yes")
    else:
        print("No")
    return
solve()
#sys.setrecursionlimit(10 ** 6)#再帰関数ではコメントにしないこと!!
0