# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
668388 | Rifal | Zalmoxis (BOI18_zalmoxis) | C++14 | 153 ms | 7024 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
//#include <fstream>
#define endl '\n'
#define mod 5000000
#define INF 100000000000000000
//define ll long long
//ofstream fout("split.out");
//ifstream fin("split.in");
//#define cin fin
//#define cout fout
#define fi first
#define se second
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
int n, k ;cin >> n >> k; vector<int> v; stack<int> st;
for(int i = 0; i < n; i++) {
int x; cin >> x;
while(!st.empty() && st.top() < x) {
int z = st.top();
v.push_back(z);
while(z == st.top()) {
st.pop();
z++;
}
st.push(z);
}
st.push(x);
v.push_back(x);
int y = st.top(); st.pop();
while(!st.empty() && st.top() == y) {
st.pop();
y++;
}
if(y < 30) st.push(y);
}
while(!st.empty() && st.top() != 30) {
int y = st.top();
st.pop();
v.push_back(y);
y++;
while(!st.empty() && st.top()== y) {
st.pop(); y++;
}
if(y != 30) st.push(y);
}
for(int i = 0; i < v.size(); i++) {
cout << v[i] << ' ';
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |