Submission #652678

# Submission time Handle Problem Language Result Execution time Memory
652678 2022-10-23T17:41:07 Z Blagoj Radio Towers (IOI22_towers) C++17
0 / 100
661 ms 2216 KB
#include "towers.h"
 
#include <bits/stdc++.h>
 
using namespace std;
 
vector<int> h;

int f[100009], p[100009];

bool used[100009];

void init(int N, std::vector<int> H) {
  h = H;
  f[0] = 1000000009;
  f[H.size() + 1] = 0;
  for (int i = 1; i <= N; i++)
  {
    f[i] = H[i - 1];
  }
  p[0] = 0;
  for (int i = 1; i <= N; i++)
  {
    p[i] = p[i - 1];
    if (f[i - 1] > f[i] && f[i + 1] > f[i])
    {
      p[i]++;
      used[i] = true;
    }
  }
}
 
int max_towers(int L, int R, int D) {
  int ans = p[R] - p[L - 1];
  if (!used[L] && f[L - 1] > f[L])
  {
    ans++;
  }
  if (L != R && !used[R] && f[R + 1] > f[R])
  {
    ans++;
  }
  return max(ans, 1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 334 ms 1448 KB 12th 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: '16'
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: '16'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 661 ms 2216 KB 1st lines differ - on the 1st token, expected: '11903', found: '11902'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 288 ms 840 KB 1st lines differ - on the 1st token, expected: '7197', found: '8003'
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: '16'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 334 ms 1448 KB 12th lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -