結果

問題 No.1376 Simple LPS Problem
ユーザー pyonth
提出日時 2021-02-06 00:03:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 1,333 bytes
コンパイル時間 1,834 ms
コンパイル使用メモリ 194,480 KB
最終ジャッジ日時 2025-01-18 13:15:15
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 60
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr int inf = 1e9 + 10;
constexpr ll INF = (ll)4e18 + 10;
constexpr int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
constexpr int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
template <typename T>
inline bool chmax(T &a, T b) {
    return ((a < b) ? (a = b, true) : (false));
}
template <typename T>
inline bool chmin(T &a, T b) {
    return ((a > b) ? (a = b, true) : (false));
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    if (k >= 4) {
        string s = "0";
        rep(i, k - 2) s += "1";
        rep(i, k - 2) s += "0";
        s += "1";
        rep(i, n) cout << s[i % (k * 2 - 2)];
        cout << endl;
    } else if (n <= k * 2) {
        rep(i, k) cout << 1;
        rep(i, n - k) cout << 0;
        cout << endl;
    } else {
        if (k == 3) {
            if (n == 7)
                cout << 1101000 << endl;
            else if (n == 8)
                cout << 11101000 << endl;
            else
                cout << -1 << endl;
        } else {
            cout << -1 << endl;
        }
    }

    return 0;
}
0