結果

問題 No.1594 Three Classes
コンテスト
ユーザー dango
提出日時 2023-07-14 18:59:38
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 354 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 158 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 80,416 KB
最終ジャッジ日時 2026-04-05 08:22:48
合計ジャッジ時間 1,839 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
純コード判定待ち
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = False
    for id in range(3 ** n):
        i = id
        arr = [0] * 3
        for j in range(n):
            arr[i % 3] += a[j]
            i //= 3
        if arr[0] == arr[1] == arr[2]:
            ans = True
            break
    print("Yes" if ans else "No")
main()
0