Submission #836199

# Submission time Handle Problem Language Result Execution time Memory
836199 2023-08-24T08:40:36 Z tengiz05 Radio Towers (IOI22_towers) C++17
0 / 100
392 ms 1744 KB
#include "towers.h"

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

vector<int> A, B, H;
int k;
int n;
void init(int N, vector<int> h) {
    n = N;
    k = n - 1;
    H = h;
    for (int i = 0; i < n - 1; i++) {
        if (h[i] < h[i + 1]) {
            A.push_back(h[i]);
        } else {
            k = i;
            break;
        }
    }
    for (int i = n - 1; i > 0; i--) {
        if (h[i] < h[i - 1]) {
            B.push_back(h[i]);
        }
    }
}

int max_towers(int L, int R, int D) {
    int l = upper_bound(A.begin(), A.end(), H[k] - D) - A.begin();
    int r = upper_bound(B.begin(), B.end(), H[k] - D) - B.begin();
    r = n - r;
    int a = max(0, l - L);
    int b = max(0, R - r + 1);
    if (a > 0 && b > 0) {
        return a + b;
    } else {
        return 1;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 392 ms 1312 KB 12th lines differ - on the 1st token, expected: '2', found: '35365'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 1 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 358 ms 1744 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 238 ms 592 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 1 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 392 ms 1312 KB 12th lines differ - on the 1st token, expected: '2', found: '35365'
2 Halted 0 ms 0 KB -