結果
| 問題 |
No.2210 equence Squence Seuence
|
| コンテスト | |
| ユーザー |
FplusFplusF
|
| 提出日時 | 2023-02-10 23:19:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 932 bytes |
| コンパイル時間 | 2,048 ms |
| コンパイル使用メモリ | 194,660 KB |
| 最終ジャッジ日時 | 2025-02-10 13:38:52 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 9 |
ソースコード
#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;
}
FplusFplusF