結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,376 KB
testcase_07 AC 66 ms
6,512 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 80 ms
6,736 KB
testcase_14 AC 81 ms
6,796 KB
testcase_15 AC 81 ms
7,000 KB
testcase_16 AC 79 ms
6,796 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 62 ms
6,304 KB
testcase_24 AC 46 ms
5,152 KB
testcase_25 AC 55 ms
6,160 KB
testcase_26 AC 74 ms
6,552 KB
testcase_27 AC 21 ms
4,384 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