結果

問題 No.1594 Three Classes
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-07-11 18:29:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 552 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-04-28 00:39:45
合計ジャッジ時間 6,360 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 552 ms
76,672 KB
testcase_01 AC 34 ms
52,096 KB
testcase_02 AC 32 ms
51,840 KB
testcase_03 AC 87 ms
76,416 KB
testcase_04 AC 511 ms
76,160 KB
testcase_05 AC 518 ms
76,544 KB
testcase_06 AC 49 ms
63,616 KB
testcase_07 AC 75 ms
76,160 KB
testcase_08 AC 513 ms
76,416 KB
testcase_09 AC 521 ms
76,240 KB
testcase_10 AC 528 ms
76,656 KB
testcase_11 AC 514 ms
76,544 KB
testcase_12 AC 521 ms
76,544 KB
testcase_13 AC 36 ms
52,352 KB
testcase_14 AC 125 ms
76,288 KB
testcase_15 AC 115 ms
76,416 KB
testcase_16 AC 83 ms
76,416 KB
testcase_17 AC 81 ms
76,032 KB
testcase_18 AC 34 ms
51,968 KB
testcase_19 AC 72 ms
76,416 KB
testcase_20 AC 70 ms
76,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
n = int(input())
e = list(map(int, input().split()))
ans = 0
for b in range(3 ** n):
    s = Base_10_to_n(b, 3).zfill(n)
    l1, l2, l3 = [], [], []
    for i in range(n):
        if s[i] == "0":
            l1.append(e[i])
        elif s[i] == "1":
            l2.append(e[i])
        else:
            l3.append(e[i])
    if sum(l1) == sum(l2) == sum(l3):
        exit(print("Yes"))
print("No")
0