# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74343 | 2018-08-31T10:53:05 Z | khsoo01 | Box Run (FXCUP3_box) | C++11 | 155 ms | 30720 KB |
#include<bits/stdc++.h> using namespace std; const int N = 500005, L = 524288; int n, a[N]; struct segtree { int v[2*L]; void build () { for(int i=1;i<=n;i++) { v[i+L] = a[i]; } for(int i=L;--i;) { v[i] = max(v[2*i], v[2*i+1]); } } int lb (int I, int V) { I += L; while(I&(I+1)) { if(v[I] >= V) break; I = (I-1)/2; } if((I&(I+1)) == 0) return 0; while(I < L) { I = 2*I + (v[2*I+1] >= V); } return I - L; } } seg; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); } seg.build(); int I = 1; for(int i=1;i<=n;i++) { int T = i - seg.lb(i-1, a[i]) - 1; while(I <= T) { printf("%d ",i-I); I++; } } for(int i=I;i<=n;i++) { printf("-1 "); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2424 KB | Output is correct |
2 | Correct | 4 ms | 2424 KB | Output is correct |
3 | Correct | 4 ms | 2624 KB | Output is correct |
4 | Correct | 4 ms | 2624 KB | Output is correct |
5 | Correct | 4 ms | 2624 KB | Output is correct |
6 | Correct | 4 ms | 2624 KB | Output is correct |
7 | Correct | 4 ms | 2624 KB | Output is correct |
8 | Correct | 4 ms | 2624 KB | Output is correct |
9 | Correct | 4 ms | 2624 KB | Output is correct |
10 | Correct | 5 ms | 2644 KB | Output is correct |
11 | Correct | 4 ms | 2648 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2424 KB | Output is correct |
2 | Correct | 4 ms | 2424 KB | Output is correct |
3 | Correct | 4 ms | 2624 KB | Output is correct |
4 | Correct | 4 ms | 2624 KB | Output is correct |
5 | Correct | 4 ms | 2624 KB | Output is correct |
6 | Correct | 4 ms | 2624 KB | Output is correct |
7 | Correct | 4 ms | 2624 KB | Output is correct |
8 | Correct | 4 ms | 2624 KB | Output is correct |
9 | Correct | 4 ms | 2624 KB | Output is correct |
10 | Correct | 5 ms | 2644 KB | Output is correct |
11 | Correct | 4 ms | 2648 KB | Output is correct |
12 | Correct | 4 ms | 2652 KB | Output is correct |
13 | Correct | 5 ms | 2664 KB | Output is correct |
14 | Correct | 17 ms | 3608 KB | Output is correct |
15 | Correct | 25 ms | 4700 KB | Output is correct |
16 | Correct | 33 ms | 6060 KB | Output is correct |
17 | Correct | 80 ms | 10616 KB | Output is correct |
18 | Correct | 104 ms | 15108 KB | Output is correct |
19 | Correct | 144 ms | 20736 KB | Output is correct |
20 | Correct | 155 ms | 26568 KB | Output is correct |
21 | Correct | 145 ms | 30720 KB | Output is correct |