結果

問題 No.2655 Increasing Strides
ユーザー playerplayer
提出日時 2024-03-05 08:38:20
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 705 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 95,276 KB
最終ジャッジ日時 2024-03-05 08:38:27
合計ジャッジ時間 5,949 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
60,264 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 35 ms
53,460 KB
testcase_05 AC 34 ms
53,460 KB
testcase_06 AC 34 ms
53,460 KB
testcase_07 AC 35 ms
53,460 KB
testcase_08 AC 35 ms
53,460 KB
testcase_09 AC 35 ms
53,460 KB
testcase_10 AC 35 ms
53,460 KB
testcase_11 AC 35 ms
53,460 KB
testcase_12 AC 35 ms
53,460 KB
testcase_13 AC 34 ms
53,460 KB
testcase_14 AC 34 ms
53,460 KB
testcase_15 AC 34 ms
53,460 KB
testcase_16 AC 34 ms
53,460 KB
testcase_17 AC 35 ms
53,460 KB
testcase_18 AC 367 ms
67,224 KB
testcase_19 AC 43 ms
59,640 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

H, W = [], []
for i in range(1, n + 1):
    if i % 2 == 1:
        H.append(i)
    else:
        W.append(i)

# print(H)
# print(W)

sh, sw = sum(H), sum(W)
if sh % 2 != 0 or sw%2 != 0:
    # print(sh % 2, sw % 2)
    print("No")
    exit()

dph = [False] * (sh // 2 + 1)
dpw = [False] * (sw // 2 + 1)

dph[0], dpw[0] = True, True

for i in range(sh // 2):
    if dph[i]:
        for j in H:
            if i + j <= sh // 2:
                dph[i + j] = True

for i in range(sw // 2):
    if dpw[i]:
        for j in W:
            if i + j <= sw // 2:
                dpw[i + j] = True

# print(dph)
# print(dpw)

if dph[sh // 2] and dpw[sw // 2]:
    print("Yes")
else:
    print("No")
0