Submission #1062060

# Submission time Handle Problem Language Result Execution time Memory
1062060 2024-08-16T18:06:04 Z MarwenElarbi Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 2792 KB
#include <bits/stdc++.h>
using namespace std;
#include "towers.h"
#define pb push_back
#define ll long long
#define fi first
#define se second
const int nax=1e5+5;
int n;
vector<int> tab;
void init(int N, std::vector<int> H) {
  n=N;
  for (int i = 0; i < N; ++i)
  {
    tab.pb(H[i]);
  }
}

int max_towers(int L, int R, int D){
  int dp[n];
  int ans=0;
  priority_queue<pair<int,int>> pq;
  int cnt=0;
  for (int i = L; i <= R; ++i)
  {
    dp[i]=1;
    while(!pq.empty()){
      auto cur=pq.top();
      if(tab[i]-cur.fi>=D){
        pq.pop();
        cnt=max(cnt,cur.se);
      }else break;
    }
    dp[i]=max(dp[i],cnt+1);
    pq.push({tab[i],dp[i]});
    ans=max(ans,dp[i]);
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4027 ms 2236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4085 ms 2792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4065 ms 1668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4027 ms 2236 KB Time limit exceeded
2 Halted 0 ms 0 KB -