結果

問題 No.1594 Three Classes
ユーザー syunsukesyunsuke
提出日時 2021-07-10 17:06:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 421 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 77,100 KB
最終ジャッジ日時 2023-08-10 07:01:14
合計ジャッジ時間 5,925 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 420 ms
76,872 KB
testcase_01 AC 70 ms
71,192 KB
testcase_02 AC 71 ms
71,100 KB
testcase_03 AC 95 ms
76,412 KB
testcase_04 AC 70 ms
71,048 KB
testcase_05 AC 416 ms
76,592 KB
testcase_06 AC 78 ms
76,512 KB
testcase_07 AC 86 ms
76,088 KB
testcase_08 AC 418 ms
76,880 KB
testcase_09 AC 421 ms
76,964 KB
testcase_10 AC 416 ms
77,100 KB
testcase_11 AC 417 ms
76,568 KB
testcase_12 AC 411 ms
76,572 KB
testcase_13 AC 69 ms
71,092 KB
testcase_14 AC 126 ms
76,300 KB
testcase_15 AC 120 ms
76,468 KB
testcase_16 AC 97 ms
76,180 KB
testcase_17 AC 92 ms
76,432 KB
testcase_18 AC 69 ms
71,276 KB
testcase_19 AC 69 ms
71,160 KB
testcase_20 AC 81 ms
76,232 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