結果

問題 No.1594 Three Classes
ユーザー hirakuhiraku
提出日時 2021-07-10 09:07:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,926 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 8,248 KB
最終ジャッジ日時 2023-09-14 18:41:30
合計ジャッジ時間 20,192 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,871 ms
8,248 KB
testcase_01 AC 16 ms
8,232 KB
testcase_02 AC 16 ms
8,212 KB
testcase_03 AC 101 ms
8,100 KB
testcase_04 AC 1,912 ms
8,128 KB
testcase_05 AC 1,926 ms
8,076 KB
testcase_06 AC 17 ms
8,148 KB
testcase_07 AC 59 ms
8,096 KB
testcase_08 AC 1,915 ms
8,188 KB
testcase_09 AC 1,892 ms
8,100 KB
testcase_10 AC 1,880 ms
8,156 KB
testcase_11 AC 1,867 ms
8,164 KB
testcase_12 AC 1,897 ms
8,108 KB
testcase_13 AC 16 ms
8,104 KB
testcase_14 AC 272 ms
8,188 KB
testcase_15 AC 238 ms
8,092 KB
testcase_16 AC 120 ms
8,100 KB
testcase_17 AC 84 ms
8,188 KB
testcase_18 AC 16 ms
8,132 KB
testcase_19 AC 22 ms
8,100 KB
testcase_20 AC 29 ms
8,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product

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

ptn = product(range(3), repeat=n)

for p in ptn:
  A = sum(E[i] for i, g in enumerate(p) if g == 0)
  B = sum(E[i] for i, g in enumerate(p) if g == 1)
  C = sum(E[i] for i, g in enumerate(p) if g == 2)
  if A == B == C:
    print("Yes")
    exit()
print("No")
0