結果

問題 No.1594 Three Classes
ユーザー とりゐとりゐ
提出日時 2021-07-09 21:26:09
言語 PyPy3
(7.9.16)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 264 ms
実行使用メモリ 81,852 KB
最終ジャッジ日時 2022-12-17 01:26:11
合計ジャッジ時間 4,555 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 169 ms
81,668 KB
testcase_01 AC 105 ms
76,172 KB
testcase_02 AC 104 ms
75,936 KB
testcase_03 AC 114 ms
81,372 KB
testcase_04 AC 165 ms
81,616 KB
testcase_05 AC 167 ms
81,808 KB
testcase_06 AC 111 ms
81,788 KB
testcase_07 AC 112 ms
81,624 KB
testcase_08 AC 167 ms
81,652 KB
testcase_09 AC 167 ms
81,648 KB
testcase_10 AC 169 ms
81,852 KB
testcase_11 AC 168 ms
81,652 KB
testcase_12 AC 172 ms
81,608 KB
testcase_13 AC 109 ms
76,368 KB
testcase_14 AC 124 ms
81,772 KB
testcase_15 AC 126 ms
81,584 KB
testcase_16 AC 121 ms
81,420 KB
testcase_17 AC 120 ms
81,772 KB
testcase_18 AC 110 ms
76,064 KB
testcase_19 AC 120 ms
81,768 KB
testcase_20 AC 117 ms
81,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
from collections import deque,Counter
#sys.setrecursionlimit(10**7)
int1=lambda x: int(x)-1

mi=lambda :map(int,input().split())
li=lambda :list(mi())
mi1=lambda :map(int1,input().split())
li1=lambda :list(mi1())
mis=lambda :map(str,input().split())
lis=lambda :list(mis())

from collections import defaultdict
"""
d=defaultdict(int) #初期値 0
d=defaultdict(lambda:1) #初期値 1
"""

mod=10**9+7
Mod=998244353
INF=10**18
ans=0


n=int(input())
a=li()
import itertools

all = itertools.product([0,1,2], repeat=n)
for x in all:
  c=[0,0,0]
  for i in range(n):
    c[x[i]]+=a[i]
  if c[0]==c[1]==c[2]:
    print('Yes')
    exit()
print('No')
0