結果

問題 No.1619 Coccinellidae
ユーザー srjywrdnprkt
提出日時 2024-03-15 14:30:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 2,014 ms
コンパイル使用メモリ 194,208 KB
最終ジャッジ日時 2025-02-20 04:31:20
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    //6=4+2
    //0 0 0 0 4 0
    //0 0 2 0 4 0

    ll N, K, M, now=0;
    cin >> N >> M >> K;

    vector<ll> ans(N+1, -1);

    for (int i=N-1; i>=1; i--){
        if (K >= i){
            K -= i;
            ans[i+1] = now;
            now++;
        }
    }

    for (int i=1; i<=N; i++){
        if (ans[i] == -1){
            ans[i] = now;
            now++;
        }
    }

    M -= N*(N-1)/2;

    for (int i=1; i<=N; i++) if (ans[i] == N-1) ans[i] += M;

    for (int i=1; i<=N; i++) cout << ans[i] << endl;

    return 0;
}
0