結果
| 問題 |
No.2210 equence Squence Seuence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-05 13:12:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 764 bytes |
| コンパイル時間 | 1,665 ms |
| コンパイル使用メモリ | 173,756 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-18 01:33:57 |
| 合計ジャッジ時間 | 3,667 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
k--;
deque<int> Q;
Q.push_back(n - 1);
for (int i = n - 2; i >= 0; i--) {
if (a[i] == a[i + 1]) {
if (Q.back() == i + 1) {
Q.push_back(i);
} else {
Q.push_front(i);
}
} else if (a[i + 1] < a[i]) {
Q.push_front(i);
} else {
Q.push_back(i);
}
}
for (int i = 0; i < n; i++) {
if (i == Q[k]) {
continue;
}
cout << a[i] << ' ';
}
cout << endl;
}