結果
問題 |
No.2655 Increasing Strides
|
ユーザー |
![]() |
提出日時 | 2024-03-05 08:38:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 705 bytes |
コンパイル時間 | 357 ms |
コンパイル使用メモリ | 82,080 KB |
実行使用メモリ | 95,796 KB |
最終ジャッジ日時 | 2024-09-29 17:48:01 |
合計ジャッジ時間 | 5,382 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 TLE * 1 -- * 15 |
ソースコード
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")