結果

問題 No.1594 Three Classes
ユーザー 330Xs330Xs
提出日時 2022-02-04 17:24:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 77,928 KB
最終ジャッジ日時 2023-09-02 04:19:44
合計ジャッジ時間 7,649 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 398 ms
77,168 KB
testcase_01 AC 74 ms
71,356 KB
testcase_02 AC 74 ms
71,220 KB
testcase_03 WA -
testcase_04 AC 74 ms
71,436 KB
testcase_05 AC 389 ms
77,196 KB
testcase_06 AC 95 ms
76,736 KB
testcase_07 WA -
testcase_08 AC 406 ms
77,260 KB
testcase_09 AC 384 ms
77,164 KB
testcase_10 AC 392 ms
77,164 KB
testcase_11 AC 396 ms
77,172 KB
testcase_12 AC 397 ms
77,236 KB
testcase_13 AC 84 ms
71,188 KB
testcase_14 AC 100 ms
76,752 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 78 ms
70,980 KB
testcase_19 AC 74 ms
71,364 KB
testcase_20 AC 83 ms
76,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
if(sum(a) % 3 != 0):
    print('No')
else:
    elem = sum(a) // 3
    for i in range(3**n):
        lis1 = []
        lis2 = []
        lis3 = []
        ind = set()
        for j in range(n):
            if((i >> j) & 2):
                lis1.append(a[j])
            else:
                if((i >> j) & 1):
                    lis2.append(a[j])
                else:
                    lis3.append(a[j])
                ind.add(j)
        if(sum(lis1) == elem):
            if(sum(lis2) == elem):
                print('Yes')
                exit(0)
    
    print('No')
                
            
0