結果

問題 No.2210 equence Squence Seuence
ユーザー shobonvipshobonvip
提出日時 2023-02-10 21:53:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 910 bytes
コンパイル時間 4,203 ms
コンパイル使用メモリ 263,816 KB
実行使用メモリ 10,908 KB
最終ジャッジ日時 2023-09-21 23:05:14
合計ジャッジ時間 7,537 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 26 ms
4,964 KB
testcase_04 AC 29 ms
4,872 KB
testcase_05 AC 45 ms
5,908 KB
testcase_06 AC 38 ms
5,776 KB
testcase_07 AC 101 ms
9,228 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 126 ms
10,896 KB
testcase_14 AC 127 ms
10,764 KB
testcase_15 AC 127 ms
10,712 KB
testcase_16 AC 127 ms
10,908 KB
testcase_17 AC 127 ms
10,700 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 69 ms
7,912 KB
testcase_24 AC 52 ms
6,656 KB
testcase_25 AC 62 ms
7,312 KB
testcase_26 AC 82 ms
8,832 KB
testcase_27 AC 23 ms
4,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

typedef modint998244353 mint;
typedef long long ll;

int main(){
	int n, k; cin >> n >> k;
	vector<int> a(n);
	for (int i=0; i<n; i++){
		cin >> a[i];
	}
	//:vector<int> b = a;
	//reverse(b.begin(), b.end());
	vector<int> sa = suffix_array(a);
	vector<int> ans(0);

	for (int i=0; i<n; i++){
		//cout << sa[i] << endl;;
	}
	
	vector<int> lets(n);
	for (int i=0; i<n; i++){
		lets[sa[i]] = i;
	}

	vector<int> v(0), w(0);
	
	for (int i=0; i<n-1; i++){
		if (lets[i] > lets[i+1]){
			v.push_back(i);
		}else{
			w.push_back(i);
		}
	}

	vector<int> r = v;
	r.push_back(n-1);
	reverse(w.begin(), w.end());
	for (int i=0; i<w.size(); i++){
		r.push_back(w[i]);
	}

	for (int i=0; i<n; i++){
		if (r[k-1] == i) continue;
		ans.push_back(a[i]);
	}
	
	for (int i=0; i<n-1; i++){
		cout << ans[i] << " ";
	}
	cout << "\n";
}
0