| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 72020 | (#118) | Box Run (FXCUP3_box) | C++17 | 189 ms | 7640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <climits>
#include <stack>
using namespace std;
struct S { int x, h; };
int p[500002];
int ans[500002];
stack<S> st;
int main(){
int N; scanf("%d", &N);
for(int i = 1; i <= N; i++) scanf("%d", &p[i]);
for(int i = 1; i <= N; i++) ans[i] = -1;
st.push({ 0, INT_MAX });
int last = 0;
for(int i = 1; i <= N; i++){
while(!st.empty() && p[i] > st.top().h){
st.pop();
}
int width = i - st.top().x - 1;
if(width > last){
for(int x = last + 1; x <= width; x++) ans[x] = i - x;
last = width;
}
st.push({ i, p[i] });
}
for(int i = 1; i <= N; i++) printf("%d ", ans[i]);
printf("\n");
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
