結果

問題 No.1619 Coccinellidae
ユーザー rianoriano
提出日時 2021-07-22 21:47:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 780 bytes
コンパイル時間 3,570 ms
コンパイル使用メモリ 168,036 KB
実行使用メモリ 5,592 KB
最終ジャッジ日時 2023-09-24 16:25:35
合計ジャッジ時間 4,294 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 104 ms
5,096 KB
testcase_02 AC 130 ms
4,944 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 133 ms
5,592 KB
testcase_05 AC 79 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 81 ms
4,436 KB
testcase_08 AC 76 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 68 ms
4,376 KB
testcase_11 AC 95 ms
4,800 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 127 ms
5,356 KB
testcase_14 AC 136 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define Pr pair<ll,ll>
#define Tp tuple<ll,ll,ll>
using Graph = vector<vector<int>>;

const ll mod = 998244353;

int main() {
    ll N,M,K; cin >> N >> M >> K;
    ll r = M-N*(N-1)/2;
    vector<ll> perm;
    rep(i,N){
        perm.push_back(i);
    }
    perm[N-1] += r;
    vector<ll> fr;
    bool tr[N];
    rep(i,N) tr[i] = false;
    ll inv = 0;
    rep(i,N){
        if(inv+(N-1-i)<=K){
            inv += (N-1-i);
            fr.push_back(perm[N-1-i]);
            tr[N-1-i] = true;
        }
    }
    rep(i,fr.size()){
        cout << fr[i] << endl;
    }
    rep(i,N){
        if(tr[i]) continue;
        cout << perm[i] << endl;
    }
    //cout << endl;
}
0