結果

問題 No.478 一般門松列列
ユーザー t98slider
提出日時 2023-03-07 10:03:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 1,658 ms
コンパイル使用メモリ 167,852 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-18 02:05:51
合計ジャッジ時間 2,915 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> ans(n);
    for(int i = 0; i < n; i += 2){
        if(i & 2) ans[i] = 1;
        else ans[i] = 2;
    }
    for(int i = 1; i < n; i += 2){
        if(i & 2) ans[i] = 3;
        else ans[i] = 4;
    }
    for(int i = k - 1; i >= 0; i--){
        ans[i] = ans[i + 1];
    }
    for(int i = 0; i < n; i++){
        cout << ans[i] << (i + 1 == n ? '\n' : ' ');
    }
}
0