結果

問題 No.478 一般門松列列
ユーザー uenokuuenoku
提出日時 2017-01-27 23:59:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 986 bytes
コンパイル時間 868 ms
コンパイル使用メモリ 84,208 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-23 17:55:43
合計ジャッジ時間 3,632 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
lli MOD = 1000000007;
int main()

{
    int n, k;
    cin >> n >> k;
    int l = n - k - 2;
    int cnt = 0;
    int sum = 0;
    string s = "";
    if (l > 2) {
        l -= 2;
        s += "0 2 1 3 ";
        cnt += 4;
        while (l - 4 >= 0) {
            s += "0 2 1 3 ";
            l -= 4;
            cnt += 4;
        }
    }
    if (l == 1) {
        s += "0 ";
        cnt += 1;
    }
    if (l == 2) {
        s += "0 2 ";
        cnt += 2;
    }
    if (l == 2) {
        s += "0 2 1 ";
        cnt += 3;
    }
    if (cnt > n) {
        cout << -1 << endl;
        return 0;
    }
    string g = "";
    rep(i, n - cnt)
    {
        g += "0 ";
    }

    cout << g + s << endl;
}
0