結果

問題 No.1619 Coccinellidae
ユーザー ytftytft
提出日時 2021-08-25 15:20:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 839 bytes
コンパイル時間 1,724 ms
コンパイル使用メモリ 168,648 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 05:05:11
合計ジャッジ時間 5,848 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 WA -
testcase_02 AC 132 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 WA -
testcase_05 AC 82 ms
6,944 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 78 ms
6,940 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 96 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 137 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N;
    long long K,M;
    cin>>N>>M>>K;
    vector<long long> answer(N,-1);
    for(int i=N-1;i>=0;--i){
        if(K>=i){
            K-=i;
            answer[i]=(N-1-i);
        }else{
            answer[K]=(N-1-i);
            int pointer=0;
            for(int j=N-i;j<N;j++){
                while(answer[pointer]!=-1){
                    ++pointer;
                }
                answer[pointer]=j;
            }
            break;
        }
    }
    for(int i=0;i<N;i++){
        if(answer[i]==N-1){
            cout<<(M-N*(N-1)/2)<<endl;
        }else{
            cout<<(++answer[i])<<endl;
        }
    }
    for(int i=0;i<N;i++){
        if(answer[i]==N-1){
            answer[i]=M-N*(N-1)/2;
        }else{
            ++answer[i];
        }
    }
}
0