結果

問題 No.1594 Three Classes
ユーザー るこーそーるこーそー
提出日時 2024-09-25 12:39:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 851 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 75,924 KB
最終ジャッジ日時 2024-09-25 12:39:23
合計ジャッジ時間 11,573 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 851 ms
75,792 KB
testcase_01 AC 38 ms
53,256 KB
testcase_02 AC 39 ms
53,260 KB
testcase_03 AC 315 ms
75,468 KB
testcase_04 AC 851 ms
75,924 KB
testcase_05 AC 848 ms
75,748 KB
testcase_06 AC 315 ms
75,564 KB
testcase_07 AC 324 ms
75,528 KB
testcase_08 AC 849 ms
75,528 KB
testcase_09 AC 848 ms
75,748 KB
testcase_10 AC 817 ms
75,600 KB
testcase_11 AC 845 ms
75,448 KB
testcase_12 AC 820 ms
75,756 KB
testcase_13 AC 51 ms
62,692 KB
testcase_14 AC 391 ms
75,404 KB
testcase_15 AC 360 ms
75,552 KB
testcase_16 AC 137 ms
75,592 KB
testcase_17 AC 323 ms
75,520 KB
testcase_18 AC 40 ms
52,552 KB
testcase_19 AC 52 ms
63,556 KB
testcase_20 AC 57 ms
68,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**5)
input=sys.stdin.readline
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')

n=int(input())
E=list(map(int,input().split()))

for mask in range(1<<(2*n)):
    ok=True
    A,B,C=0,0,0
    for i in range(n):
        bit=(mask>>(2*i))&3
        if bit==1:
            A+=E[i]
        elif bit==2:
            B+=E[i]
        elif bit==3:
            C+=E[i]
        else:
            ok=False
            break

    if ok and A==B==C:
        print("Yes")
        exit()

print("No")
0