結果

問題 No.1594 Three Classes
ユーザー tnodinotnodino
提出日時 2021-08-08 21:40:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 613 bytes
コンパイル時間 921 ms
コンパイル使用メモリ 11,772 KB
実行使用メモリ 14,468 KB
最終ジャッジ日時 2023-10-19 22:15:50
合計ジャッジ時間 7,741 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 31 ms
10,120 KB
testcase_02 AC 30 ms
10,120 KB
testcase_03 AC 87 ms
10,120 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# No.1594 Three Classes
# https://yukicoder.me/problems/no/1594

# Step #1. 入力
N = int(input())
E = list(map(int,input().split()))

# Step #2. 前処理
power3 = [0] * (N+1)
power3[0] = 1
for i in range(1,N+1):
    power3[i] = 3 * power3[i-1]

# Step #3. 探索
for i in range(power3[N]):
    sumA = 0
    sumB = 0
    sumC = 0
    for j in range(N):
        bit = (i // power3[j]) % 3
        if bit == 0:
            sumA += E[j]
        if bit == 1:
            sumB += E[j]
        if bit == 2:
            sumC += E[j]
    if sumA == sumB and sumB == sumC:
        print('Yes')
        exit()
print('No')
0