結果

問題 No.1594 Three Classes
コンテスト
ユーザー lemon
提出日時 2021-07-09 23:57:10
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 637 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,142 ms
コンパイル使用メモリ 20,696 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2026-03-22 20:40:05
合計ジャッジ時間 20,614 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)
0