結果

問題 No.1594 Three Classes
コンテスト
ユーザー cologne
提出日時 2025-12-02 13:30:16
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 208 ms / 2,000 ms
+ 351µs
コード長 426 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 246 ms
コンパイル使用メモリ 95,588 KB
実行使用メモリ 193,664 KB
最終ジャッジ日時 2026-07-17 05:57:40
合計ジャッジ時間 4,796 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys


def input(): return sys.stdin.readline().rstrip('\n')


def main():
    n = int(input())
    *e, = map(int, input().split())
    arr = {(0, 0)}
    for v in e:
        narr = set()
        for x, y in arr:
            narr.add((x - v, y))
            narr.add((x, y - v))
            narr.add((x + v, y + v))
        arr = narr

    print('Yes' if (0, 0) in arr else 'No')


if __name__ == '__main__':
    main()
0