# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72057 | 2018-08-26T05:01:43 Z | 마릴린 희정(#2180, gs14004, ho94949) | Box Run (FXCUP3_box) | C++17 | 1000 ms | 21880 KB |
#include<bits/stdc++.h> using namespace std; int N; int H[1010101]; int ans[1010101]; int main() { scanf("%d", &N); for(int i=0; i<N; ++i) scanf("%d", H+i); H[N] = (int)1e9+1; int from = 0, to = 0; multiset<int> S; S.insert(H[0]); for(int t=0; t<N; ++t) { while(*S.rbegin() >= H[to+1]) { S.insert(H[++to]); S.erase(S.find(H[from++])); } //printf("%d %d\n", from, to); ans[t] = to+1; if(from == 0) S.insert(H[++to]); else S.insert(H[--from]); } for(int i=0; i<N; ++i) if(ans[i] == N) printf("-1 "); else printf("%d ", ans[i]-i); puts(""); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 480 KB | Output is correct |
4 | Correct | 2 ms | 480 KB | Output is correct |
5 | Correct | 2 ms | 480 KB | Output is correct |
6 | Correct | 2 ms | 480 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 668 KB | Output is correct |
9 | Correct | 3 ms | 668 KB | Output is correct |
10 | Correct | 3 ms | 668 KB | Output is correct |
11 | Correct | 2 ms | 668 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 480 KB | Output is correct |
4 | Correct | 2 ms | 480 KB | Output is correct |
5 | Correct | 2 ms | 480 KB | Output is correct |
6 | Correct | 2 ms | 480 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 668 KB | Output is correct |
9 | Correct | 3 ms | 668 KB | Output is correct |
10 | Correct | 3 ms | 668 KB | Output is correct |
11 | Correct | 2 ms | 668 KB | Output is correct |
12 | Correct | 3 ms | 668 KB | Output is correct |
13 | Correct | 5 ms | 748 KB | Output is correct |
14 | Correct | 93 ms | 3308 KB | Output is correct |
15 | Correct | 128 ms | 5088 KB | Output is correct |
16 | Correct | 146 ms | 6664 KB | Output is correct |
17 | Correct | 681 ms | 16068 KB | Output is correct |
18 | Correct | 923 ms | 21880 KB | Output is correct |
19 | Execution timed out | 1081 ms | 21880 KB | Time limit exceeded |
20 | Halted | 0 ms | 0 KB | - |