# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72184 | 2018-08-26T05:50:06 Z | The quick brown fox jumps over the lazy dog(#2200, khsoo01) | 박스런 (FXCUP3_box) | C++17 | 210 ms | 9460 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2428 KB | Output is correct |
2 | Correct | 5 ms | 2428 KB | Output is correct |
3 | Correct | 5 ms | 2480 KB | Output is correct |
4 | Correct | 7 ms | 2684 KB | Output is correct |
5 | Correct | 5 ms | 2684 KB | Output is correct |
6 | Correct | 5 ms | 2684 KB | Output is correct |
7 | Correct | 5 ms | 2684 KB | Output is correct |
8 | Correct | 5 ms | 2684 KB | Output is correct |
9 | Correct | 5 ms | 2684 KB | Output is correct |
10 | Correct | 5 ms | 2684 KB | Output is correct |
11 | Correct | 4 ms | 2684 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2428 KB | Output is correct |
2 | Correct | 5 ms | 2428 KB | Output is correct |
3 | Correct | 5 ms | 2480 KB | Output is correct |
4 | Correct | 7 ms | 2684 KB | Output is correct |
5 | Correct | 5 ms | 2684 KB | Output is correct |
6 | Correct | 5 ms | 2684 KB | Output is correct |
7 | Correct | 5 ms | 2684 KB | Output is correct |
8 | Correct | 5 ms | 2684 KB | Output is correct |
9 | Correct | 5 ms | 2684 KB | Output is correct |
10 | Correct | 5 ms | 2684 KB | Output is correct |
11 | Correct | 4 ms | 2684 KB | Output is correct |
12 | Correct | 6 ms | 2684 KB | Output is correct |
13 | Correct | 6 ms | 2684 KB | Output is correct |
14 | Correct | 22 ms | 3312 KB | Output is correct |
15 | Correct | 29 ms | 3580 KB | Output is correct |
16 | Correct | 43 ms | 3964 KB | Output is correct |
17 | Correct | 85 ms | 6028 KB | Output is correct |
18 | Correct | 113 ms | 7164 KB | Output is correct |
19 | Correct | 202 ms | 8416 KB | Output is correct |
20 | Correct | 210 ms | 9460 KB | Output is correct |
21 | Correct | 190 ms | 9460 KB | Output is correct |