結果

問題 No.2655 Increasing Strides
コンテスト
ユーザー LyricalMaestro
提出日時 2025-06-15 17:29:42
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 60 ms / 2,000 ms
+ 992µs
コード長 625 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 226 ms
コンパイル使用メモリ 96,236 KB
実行使用メモリ 88,068 KB
最終ジャッジ日時 2026-07-12 06:43:09
合計ジャッジ時間 4,077 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

## https://yukicoder.me/problems/no/2655

def solve(array):
    total_value = sum(array)

    if total_value % 2 != 0:
        return False
    
    target_value = total_value // 2

    for i in reversed(array):
        if target_value >= i:
            target_value -= i
    
    return target_value == 0


def main():
    N = int(input())

    odds = []
    evens = []
    for i in range(1, N + 1):
        if i % 2 == 0:
            evens.append(i)
        else:
            odds.append(i)
    
    if solve(odds) and solve(evens):
        print("Yes")
    else:
        print("No")


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