Submission #824964

# Submission time Handle Problem Language Result Execution time Memory
824964 2023-08-14T12:39:39 Z LittleCube Radio Towers (IOI22_towers) C++17
0 / 100
388 ms 1360 KB
#include "towers.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

namespace 
{
  int N, k = 0, ono = 0;
  vector<int> H;
  vector<int> contract;
  void init()
  {
    while(k + 1 < N && H[k] < H[k + 1])
      k++;
    if(k == 0 || k == N - 1)
      ono = 1;
    else
    {
      contract.resize(N);
      for (int i = k - 1; i >= 0; i--)
        contract[i] = max(contract[i + 1], H[i + 1] - H[i]);
      for (int i = k + 1; i < N; i++)
        contract[i] = max(contract[i - 1], H[i - 1] - H[i]);
    }
  }
}

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

int max_towers(int L, int R, int D) {
  if(R <= k || k <= L || ono)
    return 1;
  else if(contract[L] > D && contract[R] > D)
    return 2;
  return 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 289 ms 1184 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: '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: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 388 ms 1360 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 182 ms 556 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 0 ms 208 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 289 ms 1184 KB 12th lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -