結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 26 ms
4,376 KB
testcase_07 AC 64 ms
6,700 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 79 ms
6,820 KB
testcase_14 AC 81 ms
6,680 KB
testcase_15 AC 79 ms
6,752 KB
testcase_16 AC 79 ms
6,956 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 WA -
testcase_21 AC 1 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 62 ms
6,456 KB
testcase_24 AC 46 ms
5,088 KB
testcase_25 AC 55 ms
6,336 KB
testcase_26 AC 72 ms
6,576 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;
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--;
        if(x+1<n-1) f(x+1);
        else return;
    }
}
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