結果

問題 No.2655 Increasing Strides
ユーザー てんぷら
提出日時 2024-02-28 17:04:39
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,636 ms / 2,000 ms
コード長 813 bytes
コンパイル時間 5,616 ms
コンパイル使用メモリ 310,336 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-29 13:00:28
合計ジャッジ時間 24,609 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
using namespace std;
using namespace atcoder;
using mint = modint998244353;
const int inf = 1000000007;
const ll longinf = 1ll << 60;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    bitset<262144> dp1, dp2;
    int m = 131072;
    dp1[m] = dp2[m] = 1;
    REP(i, 1, n + 1) {
        if(i % 2) {
            dp1 = (dp1 << i) | (dp1 >> i);
        } else {
            dp2 = (dp2 << i) | (dp2 >> i);
        }
    }
    if(dp1[m] && dp2[m]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}
0