結果
| 問題 |
No.2210 equence Squence Seuence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-11 19:32:19 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,131 bytes |
| コンパイル時間 | 8,675 ms |
| コンパイル使用メモリ | 264,952 KB |
| 最終ジャッジ日時 | 2025-02-10 14:32:48 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 25 |
ソースコード
// 提出時に定数倍高速化,assertはオフ
#ifndef DEBUG
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#ifndef NDEBUG
#define NDEBUG
#endif
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
template <class T> using vec = vector<T>;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N, K;
cin >> N >> K;
vec<int>A(N);
for(int &a : A) cin >> a;
stack<int> cur;
vec<int> front, back;
for(int i = 0; i < N; i++){
if(cur.empty()){
cur.push(i);
continue;
}
if(cur.top() < i){
while(!cur.empty()){
front.push_back(cur.top());
cur.pop();
}
} else if(cur.top() < i){
while(!cur.empty()){
back.push_back(cur.top());
cur.pop();
}
}
cur.push(i);
}
reverse(all(back));
for(int &x : front) cout << x << " ";
for(int &x : back) cout << x << " ";
cout << "\n";
}