# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1026380 | 2024-07-18T03:42:28 Z | Mardonbekhazratov | 송신탑 (IOI22_towers) | C++17 | 4000 ms | 2256 KB |
#include "towers.h" #include <vector> using namespace std; int n,k; vector<int>h; bool su1=true; void init(int N, std::vector<int> H) { n=N; h=H; k=0; bool ok=true; for(int i=1;i<n;i++){ if(h[i]>h[i-1] && ok) k=i; else{ if(h[i]>h[i-1]) su1=false; ok=false; } } } int max_towers(int L, int R, int D) { if(su1){ if(L<k && R>k && h[k]-D>=h[L] && h[k]-D>=h[R]) return 2; return 1; } vector<int>a,dp(R-L+1); dp[0]=1; for(int i=L;i<=R;i++){ a.push_back(h[i]); } int ans=1; for(int i=1;i<a.size();i++){ int mx=0; dp[i]=0; for(int j=i-1;j>=0;j--){ if(a[j]-D>=a[i]) mx=max(a[j],mx); if(mx-D>=a[j]) dp[i]=max(dp[i],dp[j]); } dp[i]++; ans=max(ans,dp[i]); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 306 ms | 1112 KB | Output is correct |
2 | Correct | 685 ms | 1368 KB | Output is correct |
3 | Correct | 597 ms | 1368 KB | Output is correct |
4 | Correct | 567 ms | 1368 KB | Output is correct |
5 | Correct | 625 ms | 1368 KB | Output is correct |
6 | Correct | 588 ms | 1368 KB | Output is correct |
7 | Correct | 611 ms | 1368 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 380 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 5 ms | 452 KB | Output is correct |
21 | Correct | 6 ms | 344 KB | Output is correct |
22 | Correct | 4 ms | 344 KB | Output is correct |
23 | Correct | 0 ms | 344 KB | Output is correct |
24 | Correct | 2 ms | 344 KB | Output is correct |
25 | Correct | 1 ms | 344 KB | Output is correct |
26 | Correct | 4 ms | 344 KB | Output is correct |
27 | Correct | 4 ms | 344 KB | Output is correct |
28 | Correct | 3 ms | 344 KB | Output is correct |
29 | Correct | 3 ms | 344 KB | Output is correct |
30 | Correct | 3 ms | 344 KB | Output is correct |
31 | Correct | 3 ms | 344 KB | Output is correct |
32 | Correct | 0 ms | 344 KB | Output is correct |
33 | Correct | 0 ms | 344 KB | Output is correct |
34 | Correct | 3 ms | 344 KB | Output is correct |
35 | Correct | 2 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 380 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 5 ms | 452 KB | Output is correct |
21 | Correct | 6 ms | 344 KB | Output is correct |
22 | Correct | 4 ms | 344 KB | Output is correct |
23 | Correct | 0 ms | 344 KB | Output is correct |
24 | Correct | 2 ms | 344 KB | Output is correct |
25 | Correct | 1 ms | 344 KB | Output is correct |
26 | Correct | 4 ms | 344 KB | Output is correct |
27 | Correct | 4 ms | 344 KB | Output is correct |
28 | Correct | 3 ms | 344 KB | Output is correct |
29 | Correct | 3 ms | 344 KB | Output is correct |
30 | Correct | 3 ms | 344 KB | Output is correct |
31 | Correct | 3 ms | 344 KB | Output is correct |
32 | Correct | 0 ms | 344 KB | Output is correct |
33 | Correct | 0 ms | 344 KB | Output is correct |
34 | Correct | 3 ms | 344 KB | Output is correct |
35 | Correct | 2 ms | 344 KB | Output is correct |
36 | Correct | 589 ms | 1196 KB | Output is correct |
37 | Correct | 1014 ms | 1992 KB | Output is correct |
38 | Correct | 291 ms | 1368 KB | Output is correct |
39 | Correct | 543 ms | 1568 KB | Output is correct |
40 | Correct | 224 ms | 1368 KB | Output is correct |
41 | Execution timed out | 4103 ms | 2256 KB | Time limit exceeded |
42 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4026 ms | 1748 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4019 ms | 1060 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 380 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 5 ms | 452 KB | Output is correct |
21 | Correct | 6 ms | 344 KB | Output is correct |
22 | Correct | 4 ms | 344 KB | Output is correct |
23 | Correct | 0 ms | 344 KB | Output is correct |
24 | Correct | 2 ms | 344 KB | Output is correct |
25 | Correct | 1 ms | 344 KB | Output is correct |
26 | Correct | 4 ms | 344 KB | Output is correct |
27 | Correct | 4 ms | 344 KB | Output is correct |
28 | Correct | 3 ms | 344 KB | Output is correct |
29 | Correct | 3 ms | 344 KB | Output is correct |
30 | Correct | 3 ms | 344 KB | Output is correct |
31 | Correct | 3 ms | 344 KB | Output is correct |
32 | Correct | 0 ms | 344 KB | Output is correct |
33 | Correct | 0 ms | 344 KB | Output is correct |
34 | Correct | 3 ms | 344 KB | Output is correct |
35 | Correct | 2 ms | 344 KB | Output is correct |
36 | Correct | 589 ms | 1196 KB | Output is correct |
37 | Correct | 1014 ms | 1992 KB | Output is correct |
38 | Correct | 291 ms | 1368 KB | Output is correct |
39 | Correct | 543 ms | 1568 KB | Output is correct |
40 | Correct | 224 ms | 1368 KB | Output is correct |
41 | Execution timed out | 4103 ms | 2256 KB | Time limit exceeded |
42 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 306 ms | 1112 KB | Output is correct |
2 | Correct | 685 ms | 1368 KB | Output is correct |
3 | Correct | 597 ms | 1368 KB | Output is correct |
4 | Correct | 567 ms | 1368 KB | Output is correct |
5 | Correct | 625 ms | 1368 KB | Output is correct |
6 | Correct | 588 ms | 1368 KB | Output is correct |
7 | Correct | 611 ms | 1368 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 2 ms | 344 KB | Output is correct |
13 | Correct | 2 ms | 344 KB | Output is correct |
14 | Correct | 1 ms | 344 KB | Output is correct |
15 | Correct | 1 ms | 344 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 344 KB | Output is correct |
21 | Correct | 0 ms | 344 KB | Output is correct |
22 | Correct | 0 ms | 380 KB | Output is correct |
23 | Correct | 0 ms | 344 KB | Output is correct |
24 | Correct | 0 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 344 KB | Output is correct |
26 | Correct | 3 ms | 344 KB | Output is correct |
27 | Correct | 1 ms | 344 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 0 ms | 344 KB | Output is correct |
30 | Correct | 5 ms | 452 KB | Output is correct |
31 | Correct | 6 ms | 344 KB | Output is correct |
32 | Correct | 4 ms | 344 KB | Output is correct |
33 | Correct | 0 ms | 344 KB | Output is correct |
34 | Correct | 2 ms | 344 KB | Output is correct |
35 | Correct | 1 ms | 344 KB | Output is correct |
36 | Correct | 4 ms | 344 KB | Output is correct |
37 | Correct | 4 ms | 344 KB | Output is correct |
38 | Correct | 3 ms | 344 KB | Output is correct |
39 | Correct | 3 ms | 344 KB | Output is correct |
40 | Correct | 3 ms | 344 KB | Output is correct |
41 | Correct | 3 ms | 344 KB | Output is correct |
42 | Correct | 0 ms | 344 KB | Output is correct |
43 | Correct | 0 ms | 344 KB | Output is correct |
44 | Correct | 3 ms | 344 KB | Output is correct |
45 | Correct | 2 ms | 344 KB | Output is correct |
46 | Correct | 589 ms | 1196 KB | Output is correct |
47 | Correct | 1014 ms | 1992 KB | Output is correct |
48 | Correct | 291 ms | 1368 KB | Output is correct |
49 | Correct | 543 ms | 1568 KB | Output is correct |
50 | Correct | 224 ms | 1368 KB | Output is correct |
51 | Execution timed out | 4103 ms | 2256 KB | Time limit exceeded |
52 | Halted | 0 ms | 0 KB | - |