結果

問題 No.2210 equence Squence Seuence
ユーザー 沙耶花沙耶花
提出日時 2023-02-10 21:27:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 742 bytes
コンパイル時間 6,053 ms
コンパイル使用メモリ 265,312 KB
実行使用メモリ 5,512 KB
最終ジャッジ日時 2023-09-21 22:30:00
合計ジャッジ時間 7,335 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 17 ms
4,376 KB
testcase_04 AC 19 ms
4,380 KB
testcase_05 AC 29 ms
4,376 KB
testcase_06 AC 24 ms
4,376 KB
testcase_07 AC 62 ms
5,168 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 77 ms
5,352 KB
testcase_14 AC 77 ms
5,484 KB
testcase_15 AC 78 ms
5,492 KB
testcase_16 AC 77 ms
5,512 KB
testcase_17 AC 77 ms
5,392 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 59 ms
4,644 KB
testcase_24 AC 44 ms
4,492 KB
testcase_25 AC 52 ms
4,756 KB
testcase_26 AC 69 ms
4,964 KB
testcase_27 AC 20 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001



int main(){
	
	int N,K;
	cin>>N>>K;
	int n  =N;
	vector<int> a(N);
	rep(i,N)cin>>a[i];
	
	bool f = true;
	vector<int> x,y;
	for(int i=n-1;i>=0;i--){
		if(i!=n-1){
			if(a[i]<a[i+1])f = false;
			else if(a[i]>a[i+1])f = true;
		}
		if(f)x.push_back(i);
		else y.push_back(i);
	}
	sort(x.begin(),x.end());
	sort(y.rbegin(),y.rend());
	rep(i,y.size())x.push_back(y[i]);
	
	int b = x[K-1];
	a.erase(a.begin()+b);
	
	rep(i,N-1){
		if(i!=0)cout<<' ';
		cout<<a[i];
	}
	cout<<endl;
	
	return 0;
}
0