結果

問題 No.2210 equence Squence Seuence
ユーザー FplusFplusFFplusFplusF
提出日時 2023-02-10 23:19:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 932 bytes
コンパイル時間 2,863 ms
コンパイル使用メモリ 202,328 KB
実行使用メモリ 6,884 KB
最終ジャッジ日時 2023-09-22 00:22:10
合計ジャッジ時間 6,124 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 26 ms
4,384 KB
testcase_07 AC 65 ms
6,352 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 82 ms
6,884 KB
testcase_14 AC 82 ms
6,800 KB
testcase_15 AC 81 ms
6,732 KB
testcase_16 AC 82 ms
6,720 KB
testcase_17 WA -
testcase_18 WA -
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 63 ms
6,304 KB
testcase_24 AC 47 ms
5,020 KB
testcase_25 AC 57 ms
6,312 KB
testcase_26 AC 75 ms
6,608 KB
testcase_27 AC 22 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (long long i=0;i<(long long)(n);i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
const ll INF=(1ll<<60);
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
ll f(ll x,ll a,ll b){
    return a*x+b;
}
ll n,k;
vector<ll> a,ans;
bool t=true;
void f(ll x){
    if((n-1-x==k&&a[x]<a[x+1])||(k==0&&a[x+1]<a[x])){
        for(ll i=x+1;i<n;i++) ans.push_back(a[i]);
        return;
    }else{
        ans.push_back(a[x]);
        if(t&&a[x+1]<a[x]) k--;
        if(!t&&a[x+1]<=a[x]) k--;
        if(x+1<n-1) f(x+1);
        else return;
    }
}
int main(){
    cin >> n >> k;
    k--;
    if(n/2<=k) t=false;
    a.resize(n);
    rep(i,n) cin >> a[i];
    f(0);
    for(auto &i:ans) cout << i << " ";
    cout << endl;
}
0