結果

問題 No.1594 Three Classes
ユーザー とりゐとりゐ
提出日時 2021-07-09 21:26:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 77,960 KB
最終ジャッジ日時 2023-08-10 06:35:24
合計ジャッジ時間 3,881 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
77,896 KB
testcase_01 AC 87 ms
71,612 KB
testcase_02 AC 86 ms
71,744 KB
testcase_03 AC 99 ms
77,688 KB
testcase_04 AC 151 ms
77,528 KB
testcase_05 AC 152 ms
77,544 KB
testcase_06 AC 95 ms
77,676 KB
testcase_07 AC 96 ms
77,252 KB
testcase_08 AC 154 ms
77,396 KB
testcase_09 AC 154 ms
77,416 KB
testcase_10 AC 153 ms
77,960 KB
testcase_11 AC 152 ms
77,280 KB
testcase_12 AC 152 ms
77,584 KB
testcase_13 AC 90 ms
71,632 KB
testcase_14 AC 104 ms
77,572 KB
testcase_15 AC 102 ms
77,248 KB
testcase_16 AC 98 ms
77,368 KB
testcase_17 AC 97 ms
77,528 KB
testcase_18 AC 89 ms
71,976 KB
testcase_19 AC 98 ms
77,676 KB
testcase_20 AC 96 ms
77,580 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