結果

問題 No.2210 equence Squence Seuence
ユーザー Manuel1024
提出日時 2023-02-10 21:48:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 743 bytes
コンパイル時間 821 ms
コンパイル使用メモリ 77,676 KB
実行使用メモリ 13,884 KB
最終ジャッジ日時 2024-07-07 16:01:22
合計ジャッジ時間 6,144 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 TLE * 1 -- * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In lambda function:
main.cpp:24:5: warning: control reaches end of non-void function [-Wreturn-type]
   24 |     });
      |     ^

ソースコード

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){
            y = x;
            x = x+1;
        }else{
            x = y;
            y = y+1;
        }
        for(; max(x, y) < n; x++, y++){
            if(a[x] != a[y]) return a[x] < a[y];
        }
    });
    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