# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1026379 | 2024-07-18T03:41:23 Z | Mardonbekhazratov | Radio Towers (IOI22_towers) | C++17 | 4000 ms | 2252 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 && L<k && R>k && h[k]-D>=h[L] && h[k]-D>=h[R]) return 2; 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4022 ms | 1436 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 1 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 | 1 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 | 340 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 1 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 | 0 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 | 5 ms | 344 KB | Output is correct |
22 | Correct | 5 ms | 460 KB | Output is correct |
23 | Correct | 2 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 | 3 ms | 344 KB | Output is correct |
27 | Correct | 3 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 | 3 ms | 344 KB | Output is correct |
33 | Correct | 2 ms | 344 KB | Output is correct |
34 | Correct | 2 ms | 344 KB | Output is correct |
35 | Correct | 2 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 1 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 | 1 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 | 340 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 1 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 | 0 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 | 5 ms | 344 KB | Output is correct |
22 | Correct | 5 ms | 460 KB | Output is correct |
23 | Correct | 2 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 | 3 ms | 344 KB | Output is correct |
27 | Correct | 3 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 | 3 ms | 344 KB | Output is correct |
33 | Correct | 2 ms | 344 KB | Output is correct |
34 | Correct | 2 ms | 344 KB | Output is correct |
35 | Correct | 2 ms | 344 KB | Output is correct |
36 | Correct | 570 ms | 1192 KB | Output is correct |
37 | Correct | 966 ms | 1732 KB | Output is correct |
38 | Correct | 296 ms | 1832 KB | Output is correct |
39 | Correct | 512 ms | 1488 KB | Output is correct |
40 | Correct | 227 ms | 1368 KB | Output is correct |
41 | Execution timed out | 4097 ms | 2252 KB | Time limit exceeded |
42 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4057 ms | 1720 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4017 ms | 856 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 452 KB | Output is correct |
3 | Correct | 1 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 | 1 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 | 340 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 1 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 | 0 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 | 5 ms | 344 KB | Output is correct |
22 | Correct | 5 ms | 460 KB | Output is correct |
23 | Correct | 2 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 | 3 ms | 344 KB | Output is correct |
27 | Correct | 3 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 | 3 ms | 344 KB | Output is correct |
33 | Correct | 2 ms | 344 KB | Output is correct |
34 | Correct | 2 ms | 344 KB | Output is correct |
35 | Correct | 2 ms | 344 KB | Output is correct |
36 | Correct | 570 ms | 1192 KB | Output is correct |
37 | Correct | 966 ms | 1732 KB | Output is correct |
38 | Correct | 296 ms | 1832 KB | Output is correct |
39 | Correct | 512 ms | 1488 KB | Output is correct |
40 | Correct | 227 ms | 1368 KB | Output is correct |
41 | Execution timed out | 4097 ms | 2252 KB | Time limit exceeded |
42 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4022 ms | 1436 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |