結果

問題 No.2655 Increasing Strides
ユーザー LyricalMaestro
提出日時 2025-06-15 17:29:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 82,844 KB
実行使用メモリ 68,816 KB
最終ジャッジ日時 2025-06-15 17:29:45
合計ジャッジ時間 3,653 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

## 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