結果

問題 No.2210 equence Squence Seuence
ユーザー i_am_noob
提出日時 2023-02-11 17:13:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 2,012 ms
コンパイル使用メモリ 192,488 KB
最終ジャッジ日時 2025-02-10 14:25:10
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;

#define all(a) a.begin(),a.end()
#define pb push_back
#define sz(a) ((int)a.size())

const int maxn=200005;
int n,k,a[maxn];
bool b[maxn];

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n >> k;
    for(int i=0; i<n; ++i) cin >> a[i];
    for(int i=n-2; i>=0; --i){
        if(a[i]>a[i+1]) b[i]=0;
        else if(a[i]<a[i+1]) b[i]=1;
        else b[i]=b[i+1];
    }
    int l=1,r=n;
    for(int i=0; i<n; ++i){
        int x;
        if(b[i]) x=r,r--;
        else x=l,l++;
        if(x==k){
            for(int j=0; j<n; ++j) if(i!=j) cout << a[j] << ' ';
            cout << "\n";
            return 0;
        }
    }
}
0