結果

問題 No.1619 Coccinellidae
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2024-03-15 14:30:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 203,440 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-15 14:31:04
合計ジャッジ時間 4,913 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 100 ms
6,548 KB
testcase_02 AC 127 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 130 ms
6,548 KB
testcase_05 AC 76 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 78 ms
6,548 KB
testcase_08 AC 72 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 65 ms
6,548 KB
testcase_11 AC 91 ms
6,548 KB
testcase_12 AC 2 ms
6,548 KB
testcase_13 AC 123 ms
6,548 KB
testcase_14 AC 131 ms
6,548 KB
testcase_15 AC 2 ms
6,548 KB
testcase_16 AC 2 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

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