結果

問題 No.1594 Three Classes
ユーザー RuteRute
提出日時 2021-07-09 21:41:48
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 748 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 79,420 KB
最終ジャッジ日時 2023-08-10 06:47:43
合計ジャッジ時間 11,368 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 600 ms
78,488 KB
testcase_01 AC 71 ms
71,308 KB
testcase_02 AC 70 ms
71,212 KB
testcase_03 AC 748 ms
78,916 KB
testcase_04 AC 589 ms
78,216 KB
testcase_05 AC 592 ms
78,260 KB
testcase_06 AC 590 ms
78,804 KB
testcase_07 AC 545 ms
79,012 KB
testcase_08 AC 602 ms
78,224 KB
testcase_09 AC 596 ms
78,308 KB
testcase_10 AC 591 ms
78,164 KB
testcase_11 AC 599 ms
78,304 KB
testcase_12 AC 589 ms
78,568 KB
testcase_13 AC 90 ms
76,384 KB
testcase_14 AC 580 ms
79,080 KB
testcase_15 AC 587 ms
78,988 KB
testcase_16 AC 283 ms
78,008 KB
testcase_17 AC 743 ms
79,420 KB
testcase_18 AC 78 ms
76,496 KB
testcase_19 AC 113 ms
78,408 KB
testcase_20 AC 152 ms
78,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
E = list(map(int,input().split()))
#3bit全探索
def base10int(value, base):
    if (int(value / base)):
        return base10int(int(value / base), base) + str(value % base)
    return str(value % base)
f = 0
for i in range(3 ** N):
    now = base10int(i,3).zfill(N)
    A = 0 
    B = 0 
    C = 0
    for j in range(N):
        if now[j] == "0":
            A += E[j]
        elif now[j] == "1":
            B += E[j]
        else:
            C += E[j]
    if A == B and B == C and A == C:
        f += 1 
if f > 0:
    print("Yes")
else:
    print("No")
0