結果

問題 No.2210 equence Squence Seuence
ユーザー FplusFplusFFplusFplusF
提出日時 2023-02-10 22:14:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 826 bytes
コンパイル時間 2,221 ms
コンパイル使用メモリ 201,680 KB
実行使用メモリ 7,008 KB
最終ジャッジ日時 2023-09-21 23:29:56
合計ジャッジ時間 5,088 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 18 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 29 ms
4,768 KB
testcase_06 AC 25 ms
4,380 KB
testcase_07 AC 66 ms
6,500 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 79 ms
6,664 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 79 ms
6,596 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 WA -
testcase_23 AC 62 ms
6,456 KB
testcase_24 AC 47 ms
5,008 KB
testcase_25 AC 55 ms
6,208 KB
testcase_26 AC 72 ms
6,756 KB
testcase_27 AC 21 ms
4,380 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;
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(a[x+1]<a[x]) k--;
        f(x+1);
    }
}
int main(){
    cin >> n >> k;
    k--;
    a.resize(n);
    rep(i,n) cin >> a[i];
    f(0);
    for(auto &i:ans) cout << i << " ";
    cout << endl;
}
0