結果

問題 No.2210 equence Squence Seuence
ユーザー Manuel1024Manuel1024
提出日時 2023-02-10 21:35:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 76,516 KB
実行使用メモリ 5,952 KB
最終ジャッジ日時 2023-09-21 22:39:31
合計ジャッジ時間 3,502 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 28 ms
4,376 KB
testcase_07 AC 73 ms
5,412 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 92 ms
5,588 KB
testcase_14 WA -
testcase_15 AC 86 ms
5,556 KB
testcase_16 AC 89 ms
5,716 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 61 ms
5,316 KB
testcase_24 AC 46 ms
4,868 KB
testcase_25 AC 55 ms
5,252 KB
testcase_26 AC 73 ms
5,508 KB
testcase_27 AC 21 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n, k; cin >> n >> k;
    vector<int> a(n);
    for(auto &it: a) cin >> it;

    vector<int> v(n);
    for(int i = 0; i < n; i++) v[i] = i;
    sort(v.begin(), v.end(), [&](int x, int y){
        if(x < y) return a[x+1] < a[x];
        else return a[y] < a[y+1];
    });
    vector<int> ans;
    for(int i = 0; i < n; i++){
        if(v[k-1] == i) continue;
        ans.emplace_back(a[i]);
    }
    for(int i = 0; i < ans.size(); i++) cout << ans[i] << " \n"[i == ans.size()-1];
    return 0;
}
0