Submission #733186

# Submission time Handle Problem Language Result Execution time Memory
733186 2023-04-30T08:07:02 Z puppy Radio Towers (IOI22_towers) C++17
0 / 100
1022 ms 1840 KB
#include "towers.h"

#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
namespace {
    int N, K;
    int H[100005];
    int rH[100005];
}

void init(int N, std::vector<int> H) {
    ::N = N;
    ::K = -1;
    for (int i = 0; i < N; i++) {
        ::H[i] = H[i];
    }
    for (int i = 0; i < N - 1; i++) {
        if (H[i] > H[i+1]) {
            K = i;
            break;
        }
    }
    if (K == -1) K = N - 1;
    for (int i = 0; i < N; i++) rH[i] = H[N-1-i];
}

int max_towers(int L, int R, int D) {
  if (R <= K || K <= L) return 0;
  int it1 = upper_bound(H, H + K + 1, H[K] - D) - H - 1;
  int it2 = upper_bound(rH, rH + (N-1-K) + 1, H[K] - D) - rH - 1;
  return (it1 + 1) * (it2 + 1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 374 ms 1196 KB 1st lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1022 ms 1840 KB 1st lines differ - on the 1st token, expected: '11903', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 312 ms 560 KB 1st lines differ - on the 1st token, expected: '7197', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 374 ms 1196 KB 1st lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -