Submission #1020312

# Submission time Handle Problem Language Result Execution time Memory
1020312 2024-07-11T21:50:23 Z kym Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 1580 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>=0;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 4065 ms 1132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '14'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '14'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4078 ms 1580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4035 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '14'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4065 ms 1132 KB Time limit exceeded
2 Halted 0 ms 0 KB -