Submission #836565

# Submission time Handle Problem Language Result Execution time Memory
836565 2023-08-24T12:58:08 Z tengiz05 Radio Towers (IOI22_towers) C++17
0 / 100
9 ms 1744 KB
#include "towers.h"

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

vector<int> h;
int n;
vector<int> a;
void init(int N, vector<int> H) {
    n = N;
    h = H;
    a.resize(n);
    for (int i = 1; i < n - 1; i++) {
        if ((h[i - 1] < h[i]) != (h[i] < h[i + 1])) {
            a[i]++;
        }
    }
    for (int i = 1; i < n; i++) {
        a[i] += a[i - 1];
    }
}

int max_towers(int l, int r, int D) {
    if (l == r) {
        return 1;
    }
    int sum = a[r - 1] - a[l];
    cout << sum << "\n";
    if (h[l] > h[l + 1]) {
        sum--;
    }
    return max(1, (sum + 3) / 2);
}
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1184 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1744 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 592 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1184 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -