Submission #634083

# Submission time Handle Problem Language Result Execution time Memory
634083 2022-08-23T19:01:08 Z Utaha Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 1436 KB
#include "towers.h"

#include <bits/stdc++.h>
using namespace std;

int n;
vector<int> H;

void init(int _N, std::vector<int> _H) {
  n = _N;
  H = _H;
}

int f(int l, int r, int D, int maxHeight) {
  int highest = -1;
  int count = 0;
  for(int i = l; i < r; i++) {
    if (H[i] > maxHeight) continue;
    count += 1;
    if (highest == -1 || H[i] > H[highest]) {
      highest = i;
    }
  }
  if (count <= 1) {
    return count;
  }
  else{
    return max(1, f(l, highest, D, H[highest] - D) + f(highest + 1, r, D, H[highest] - D));
  }
}

int max_towers(int L, int R, int D) {
  return f(L, R + 1, D, 2000000000 + 5);
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4056 ms 976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '11'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '11'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4074 ms 1436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4022 ms 544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '11'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4056 ms 976 KB Time limit exceeded
2 Halted 0 ms 0 KB -