結果

問題 No.1619 Coccinellidae
ユーザー ぷらぷら
提出日時 2021-07-22 21:46:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,033 bytes
コンパイル時間 2,340 ms
コンパイル使用メモリ 202,264 KB
実行使用メモリ 4,860 KB
最終ジャッジ日時 2023-09-24 16:24:20
合計ジャッジ時間 5,831 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 103 ms
4,608 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 131 ms
4,384 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 80 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 69 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 128 ms
4,676 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    long long N,M,K;
    cin >> N >> M >> K;
    vector<int>tmp;
    for(int i = 0; i <= N-2; i++) {
        tmp.push_back(i);
        M -= i;
    }
    tmp.push_back(M);
    vector<int>ans;
    vector<int>tmp2;
    for(int i = N-1; i >= 0; i--) {
        if(K >= i) {
            K -= i;
            ans.push_back(N-i);
        }
        else {
            reverse(ans.begin(),ans.end());
            for(int j = N-i+1; j <= N; j++) {
                if(j-N+i-1 == K) {
                    tmp2.push_back(N-i);
                }
                tmp2.push_back(j);
            }
            for(int j = 0; j < ans.size(); j++) {
                tmp2.push_back(ans[j]);
            }
            break;
        }
    }
    if(tmp2.size() == 0) {
        reverse(ans.begin(),ans.end());
        for(int j = 0; j < ans.size(); j++) {
            tmp2.push_back(ans[j]);
        }
    }
    for(int i = 0; i < tmp.size(); i++) {
        cout << tmp[tmp2[i]-1] << endl;
    }
}
0