結果

問題 No.1619 Coccinellidae
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2024-03-15 14:28:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 2,705 ms
コンパイル使用メモリ 203,440 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-15 14:28:23
合計ジャッジ時間 6,519 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 WA -
testcase_02 AC 130 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 WA -
testcase_05 AC 78 ms
6,548 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 72 ms
6,548 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 90 ms
6,548 KB
testcase_12 AC 2 ms
6,548 KB
testcase_13 WA -
testcase_14 AC 125 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=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