Submission #1083819

# Submission time Handle Problem Language Result Execution time Memory
1083819 2024-09-04T08:09:36 Z SamueleVid Radio Towers (IOI22_towers) C++17
0 / 100
522 ms 1600 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

constexpr int MAXN = 1e5;
constexpr int PW = 131072;
vector<int> H;
int k;

void init(int N, vector<int> H) {
    :: H = H;

    k = 0;
    for (int i = 0; i < N - 1; i ++) {
        if (H[i] < H[i + 1]) k = i + 1;
    }
}

int max_towers(int L, int R, int D) {
    if (L >= k || R <= k) return 0;

    int dx = k - 1;
    for (int p = PW; p >= 1; p /= 2) {
        if (p + dx <= R && H[p + dx] > H[k] - D) dx += p;
    }
    dx ++;

    int sx = k + 1;
    for (int p = PW; p >= 1; p /= 2) {
        if (sx - p >= L && H[sx - p] > H[k] - D) sx -= p;
    }
    sx --;

    if (sx >= L && dx <= R) return 2;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 284 ms 1112 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 344 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 344 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 522 ms 1600 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 217 ms 852 KB 1st lines differ - on the 1st token, expected: '7197', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 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 284 ms 1112 KB 1st lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -