結果
問題 |
No.2210 equence Squence Seuence
|
ユーザー |
![]() |
提出日時 | 2023-02-11 01:57:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 589 ms / 2,000 ms |
コード長 | 650 bytes |
コンパイル時間 | 1,923 ms |
コンパイル使用メモリ | 194,440 KB |
最終ジャッジ日時 | 2025-02-10 13:54:30 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int N = 1 << 18; int n, k, a[N]; int main() { cin >> n >> k; for(int i = 1; i <= n; i ++) cin >> a[i]; vector<int> q(n); int l = 0, r = n - 1; for(int i = 1, lst = 1; i <= n; i ++) { if(a[i] < a[i + 1]) while(lst <= i) q[r --] = lst ++; if(a[i] > a[i + 1]) while(lst <= i) q[l ++] = lst ++; } for(int x : q) cerr << x << " "; cerr << "\n"; for(int i = 1; i <= n; i ++) if(i != q[k - 1]) cout << a[i] << " "; } /* 4 1 5 4 1 1 4 3 3 3 1 || \/ 5 3 3 3 1 */