結果

問題 No.1594 Three Classes
ユーザー syunsukesyunsuke
提出日時 2021-07-10 17:06:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 367 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 75,904 KB
最終ジャッジ日時 2024-04-28 00:38:19
合計ジャッジ時間 4,574 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 362 ms
75,896 KB
testcase_01 AC 34 ms
51,840 KB
testcase_02 AC 33 ms
51,968 KB
testcase_03 AC 57 ms
63,232 KB
testcase_04 AC 34 ms
51,584 KB
testcase_05 AC 347 ms
75,776 KB
testcase_06 AC 44 ms
61,696 KB
testcase_07 AC 51 ms
62,080 KB
testcase_08 AC 367 ms
75,904 KB
testcase_09 AC 348 ms
75,904 KB
testcase_10 AC 349 ms
75,648 KB
testcase_11 AC 354 ms
75,904 KB
testcase_12 AC 352 ms
75,776 KB
testcase_13 AC 36 ms
51,840 KB
testcase_14 AC 87 ms
65,024 KB
testcase_15 AC 83 ms
64,256 KB
testcase_16 AC 58 ms
63,104 KB
testcase_17 AC 55 ms
62,336 KB
testcase_18 AC 35 ms
51,584 KB
testcase_19 AC 33 ms
51,712 KB
testcase_20 AC 46 ms
61,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
E = list(map(int,input().split()))
if sum(E)%3 != 0:
    print("No")
    exit()
ANS = sum(E)//3
for i in range(3**N):
    X = 0
    Y = 0
    I = i+0
    for n in range(N):
        c =  I // (3**(N-1-n))
        if c == 0:
            X += E[n]
        elif c == 1:
            Y += E[n]
        I %=(3**(N-1-n))
    #print(X,Y)
    if X == ANS and Y == ANS:
        print("Yes")
        exit()
print("No")
0