結果

問題 No.1619 Coccinellidae
ユーザー hiikunZhiikunZ
提出日時 2021-07-22 22:36:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 1,068 bytes
コンパイル時間 2,924 ms
コンパイル使用メモリ 202,196 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-24 17:57:27
合計ジャッジ時間 5,474 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 98 ms
4,380 KB
testcase_02 AC 126 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 129 ms
4,380 KB
testcase_05 AC 79 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 77 ms
4,376 KB
testcase_08 AC 74 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 66 ms
4,380 KB
testcase_11 AC 90 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 124 ms
4,376 KB
testcase_14 AC 127 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
const ll MAX = 5000000000000000000;
const ld PI = 3.14159265358979;
const ll MOD = 0;//2024948111;
ld dotorad(ld K){return PI * K / 180.0;}
ld radtodo(ld K){return K * 180.0 / PI;}
mt19937 mt;
void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());}
int main(){
    ll N,M,K;
    cin >> N >> M >> K;
    ll m = M - ((N - 1) * (N - 2)) / 2;
    vector<ll> ans(N);
    ll p = 0,i;
    for(i = 1;i <= N - 1;i++){
        if(p + i > K){
            i--;
            break;
        }
        p += i;
    }
    if(i == N){
        cout << m << endl;
        for(ll i = N - 2;i >= 0;i--) cout << i << endl;
        return 0;
    }
    ll q = i + 1,j = 0;
    for(j = 0;j <= i;j++){
        if(q == i + 1 - (K - p)) q--;
        ans[j] = q;
        q--;
    }
    ans[i + 1] = i + 1 - (K - p);
    for(j = i + 2;j < N;j++){
        ans[j] = j;
    }
    for(ll i = 0;i < N;i++){
        if(ans[i] != N - 1) cout << ans[i] << endl;
        else cout << m << endl;
    }
}
0