Submission #784958

# Submission time Handle Problem Language Result Execution time Memory
784958 2023-07-16T20:35:10 Z thimote75 Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 1360 KB
#include "towers.h"

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

using idata = vector<int>;

idata heights;
int nbTowers;

void init(int N, idata H) {
  nbTowers = N;
  heights = H;
}

int max_towers(int L, int R, int D) {
  idata dp(nbTowers, 0);

  int curr  = L; bool middle = false;
  int count = 1;
  for (int local = L + 1; local <= R; local ++) {
    if (middle) {
      if (heights[curr] >= heights[local] + D) {
        curr   = local;
        middle = false;
        count ++;
      }
    } else {
      if (heights[local] >= heights[curr] + D) {
        curr = local;
        middle = true;
      } else if (heights[local] < heights[curr]) curr = local;
    }
  }

  return count;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1132 ms 996 KB 27th lines differ - on the 1st token, expected: '2', found: '1'
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: '7'
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: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4006 ms 1360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2551 ms 644 KB 1st lines differ - on the 1st token, expected: '7197', found: '5778'
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: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1132 ms 996 KB 27th lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -