結果

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

ソースコード

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=1;
    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) ans[i] += M;

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

    return 0;
}
0