# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
68717 | imsifile | 박스런 (FXCUP3_box) | C++98 | 222 ms | 5440 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<stdio.h>
int N, stk[505050][2], scn, dap[505050];
int main(){
scanf("%d", &N);
for(int i=1; i<=N; i++) dap[i]=-1;
stk[scn][0]=1<<30, stk[scn++][1]=-1;
for(int i=0; i<N; i++){
int a; scanf("%d", &a);
while(scn){
if(stk[scn-1][0] >= a) break;
scn--;
if(!scn) break;
int sz = i-stk[scn-1][1]-1;
if(dap[sz]<0) dap[sz]=i-sz+1;
}
stk[scn][0]=a, stk[scn][1]=i;
scn++;
}
int fl=0;
for(int i=N; i>=1; i--){
if(!fl){
if(dap[i]>=0) fl=1;
continue;
}
if(dap[i]<0 || dap[i]>dap[i+1]+1) dap[i]=dap[i+1]+1;
}
for(int i=1; i<=N; i++){
printf("%d", dap[i]);
if(i<N) printf(" ");
}
puts("");
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |