結果
| 問題 | 
                            No.1594 Three Classes
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-07-09 23:57:10 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 637 bytes | 
| コンパイル時間 | 426 ms | 
| コンパイル使用メモリ | 12,288 KB | 
| 実行使用メモリ | 21,120 KB | 
| 最終ジャッジ日時 | 2024-07-01 18:52:12 | 
| 合計ジャッジ時間 | 7,165 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | -- * 3 | 
| other | AC * 5 TLE * 4 -- * 9 | 
ソースコード
import sys
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()
ans = 'No'
for i in range(3 ** n):
    a, b, c = 0, 0, 0
    for j in range(n):
        if i % 3 == 0:
            a += E[j]
        if i % 3 == 1:
            b += E[j]
        if i % 3 == 2:
            c += E[j]
        i //= 3
    if a == b == c:
        ans = 'Yes'
        break
print(ans)