結果
問題 | No.2655 Increasing Strides |
ユーザー |
|
提出日時 | 2024-03-01 21:34:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,122 ms / 2,000 ms |
コード長 | 542 bytes |
コンパイル時間 | 2,071 ms |
コンパイル使用メモリ | 196,252 KB |
最終ジャッジ日時 | 2025-02-19 22:24:05 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, odd, even; cin >> n; odd = n / 2 + (n & 1); even = n / 2; if(odd % 4 != 0){ cout << "No\n"; return 0; } if(odd % 4 == 0 && (even == 3 || even % 4 == 0)){ cout << "Yes\n"; return 0; } bitset<400000> dp; dp[110000] = 1; for(int i = 2; i <= n; i += 2){ dp >>= i; dp |= dp << 2 * i; } cout << (dp[110000] ? "Yes" : "No") << '\n'; }