結果

問題 No.1594 Three Classes
ユーザー RuteRute
提出日時 2021-07-09 21:41:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 733 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,460 KB
最終ジャッジ日時 2024-04-28 00:06:02
合計ジャッジ時間 10,710 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 593 ms
76,684 KB
testcase_01 AC 41 ms
51,584 KB
testcase_02 AC 41 ms
52,480 KB
testcase_03 AC 729 ms
77,076 KB
testcase_04 AC 570 ms
76,852 KB
testcase_05 AC 572 ms
76,836 KB
testcase_06 AC 564 ms
76,812 KB
testcase_07 AC 519 ms
77,080 KB
testcase_08 AC 579 ms
76,920 KB
testcase_09 AC 572 ms
76,672 KB
testcase_10 AC 570 ms
76,792 KB
testcase_11 AC 568 ms
76,544 KB
testcase_12 AC 565 ms
76,928 KB
testcase_13 AC 62 ms
67,968 KB
testcase_14 AC 557 ms
76,976 KB
testcase_15 AC 574 ms
76,688 KB
testcase_16 AC 287 ms
76,984 KB
testcase_17 AC 733 ms
76,948 KB
testcase_18 AC 50 ms
61,440 KB
testcase_19 AC 82 ms
76,416 KB
testcase_20 AC 121 ms
77,460 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