Submission #1020313

# Submission time Handle Problem Language Result Execution time Memory
1020313 2024-07-11T21:51:08 Z kym Radio Towers (IOI22_towers) C++17
11 / 100
4000 ms 1736 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>A;
int n;
void init(int N, std::vector<int> H) {
  n=N;
  A=H;
}

int max_towers(int L, int R, int D) {
  int dp[n+5];memset(dp,0,sizeof dp);
  for(int i=0;i<n;i++)dp[i]=1;
  int ans=1;
  for(int i=L+2;i<=R;i++){
    int mx=A[i-1];
    for(int j=i-2;j>=L;j--){
      if(mx-D>=A[i] && mx-D >= A[j]){
        dp[i]=max(dp[i],dp[j]+1);
        ans=max(ans,dp[i]);
      }
      mx=max(mx,A[j]);
    }
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4064 ms 1132 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 1 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 356 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 596 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 2 ms 596 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 5 ms 344 KB Output is correct
23 Correct 3 ms 344 KB Output is correct
24 Correct 3 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 2 ms 460 KB Output is correct
27 Correct 5 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 2 ms 344 KB Output is correct
32 Correct 4 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 4 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 356 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 596 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 2 ms 596 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 5 ms 344 KB Output is correct
23 Correct 3 ms 344 KB Output is correct
24 Correct 3 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 2 ms 460 KB Output is correct
27 Correct 5 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 2 ms 344 KB Output is correct
32 Correct 4 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 4 ms 344 KB Output is correct
36 Correct 294 ms 1112 KB Output is correct
37 Correct 983 ms 1600 KB Output is correct
38 Correct 197 ms 1624 KB Output is correct
39 Correct 589 ms 1592 KB Output is correct
40 Correct 134 ms 1592 KB Output is correct
41 Correct 3901 ms 1588 KB Output is correct
42 Correct 11 ms 1488 KB Output is correct
43 Correct 1296 ms 1592 KB Output is correct
44 Correct 103 ms 1488 KB Output is correct
45 Correct 12 ms 1488 KB Output is correct
46 Correct 11 ms 1588 KB Output is correct
47 Correct 897 ms 1488 KB Output is correct
48 Correct 320 ms 1492 KB Output is correct
49 Correct 49 ms 1488 KB Output is correct
50 Correct 254 ms 1736 KB Output is correct
51 Correct 819 ms 1604 KB Output is correct
52 Execution timed out 4048 ms 1488 KB Time limit exceeded
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4059 ms 1492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4040 ms 600 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 1 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 356 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 596 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 2 ms 596 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 5 ms 344 KB Output is correct
23 Correct 3 ms 344 KB Output is correct
24 Correct 3 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 2 ms 460 KB Output is correct
27 Correct 5 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 2 ms 344 KB Output is correct
32 Correct 4 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 4 ms 344 KB Output is correct
36 Correct 294 ms 1112 KB Output is correct
37 Correct 983 ms 1600 KB Output is correct
38 Correct 197 ms 1624 KB Output is correct
39 Correct 589 ms 1592 KB Output is correct
40 Correct 134 ms 1592 KB Output is correct
41 Correct 3901 ms 1588 KB Output is correct
42 Correct 11 ms 1488 KB Output is correct
43 Correct 1296 ms 1592 KB Output is correct
44 Correct 103 ms 1488 KB Output is correct
45 Correct 12 ms 1488 KB Output is correct
46 Correct 11 ms 1588 KB Output is correct
47 Correct 897 ms 1488 KB Output is correct
48 Correct 320 ms 1492 KB Output is correct
49 Correct 49 ms 1488 KB Output is correct
50 Correct 254 ms 1736 KB Output is correct
51 Correct 819 ms 1604 KB Output is correct
52 Execution timed out 4048 ms 1488 KB Time limit exceeded
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4064 ms 1132 KB Time limit exceeded
2 Halted 0 ms 0 KB -