結果

問題 No.1594 Three Classes
ユーザー lemonlemon
提出日時 2021-07-10 00:12:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 75,648 KB
最終ジャッジ日時 2024-04-28 00:33:54
合計ジャッジ時間 2,204 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
75,648 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 36 ms
51,712 KB
testcase_03 AC 45 ms
65,408 KB
testcase_04 AC 98 ms
75,136 KB
testcase_05 AC 99 ms
75,648 KB
testcase_06 AC 39 ms
59,136 KB
testcase_07 AC 43 ms
62,464 KB
testcase_08 AC 100 ms
75,520 KB
testcase_09 AC 97 ms
75,392 KB
testcase_10 AC 101 ms
75,392 KB
testcase_11 AC 98 ms
75,520 KB
testcase_12 AC 100 ms
75,392 KB
testcase_13 AC 36 ms
51,840 KB
testcase_14 AC 61 ms
75,264 KB
testcase_15 AC 57 ms
75,392 KB
testcase_16 AC 50 ms
67,072 KB
testcase_17 AC 44 ms
64,512 KB
testcase_18 AC 33 ms
51,968 KB
testcase_19 AC 38 ms
59,776 KB
testcase_20 AC 40 ms
60,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, itertools

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
nsa = lambda: list(map(str, stdin.readline().split()))
ntp = lambda: tuple(map(int, stdin.readline().split()))
mod = 10 ** 9 + 7
inf = 10 ** 18

n = ni()
E = na()


for i in itertools.product(range(3), repeat=n):
    A = [0] * 3
    for j, p in enumerate(i):
        A[p] += E[j]
    if A[0] == A[1] == A[2]:
        print('Yes')
        exit()

print('No')
0