Submission #1061622

# Submission time Handle Problem Language Result Execution time Memory
1061622 2024-08-16T11:18:13 Z MarwenElarbi Radio Towers (IOI22_towers) C++17
0 / 100
474 ms 1748 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
int k=-1,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]);
  }
  for (int i = 0; i < N-1; ++i)
  {
    if(tab[i]>tab[i+1]){
      k=i;
      break;
    }
  }
}

int max_towers(int L, int R, int D){
  if(L>=k||R<=k) return 1;
  int l=L-1;
  int r=k;
  while(r-l>1){
    int mid=(r+l)/2;
    if(tab[mid]>tab[k]-D) r=mid;
    else l=mid;
  }
  int a=l;
  l=k;
  r=R+1;
  while(r-l>1){
    int mid=(r+l)/2;
    if(tab[mid]>tab[k]-D) l=mid;
    else r=mid;
  }
  int ans=max(1,a-L+1+R-r+1);
  return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 274 ms 1236 KB 2nd lines differ - on the 1st token, expected: '1', found: '5353'
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: '1'
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: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 474 ms 1748 KB 1st lines differ - on the 1st token, expected: '11903', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 187 ms 600 KB 1st lines differ - on the 1st token, expected: '7197', found: '1'
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: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 274 ms 1236 KB 2nd lines differ - on the 1st token, expected: '1', found: '5353'
2 Halted 0 ms 0 KB -