# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72002 | ----------넘사벽---------- (#118) | Box Run (FXCUP3_box) | C++11 | 180 ms | 5564 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define N 500005
using namespace std;
typedef pair<int, int> pp;
int h[N];
stack<pp> st;
int main(){
int n, i;
scanf("%d", &n);
for(i=1;i<=n;i++) scanf("%d", h+i);
st.push(pp(0, INT_MAX));
int c=1;
for(i=1;i<=n;i++){
while(!st.empty()&&st.top().second<h[i]) st.pop();
while(c<i-st.top().first){
//printf("%d ", i);
printf("%d ", i-c);
c++;
}
st.push(pp(i, h[i]));
}
while(c<=n){printf("-1 ");c++;}
printf("\n");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |