Submission #799948

# Submission time Handle Problem Language Result Execution time Memory
799948 2023-08-01T08:46:14 Z adrilen Radio Towers (IOI22_towers) C++17
0 / 100
10 ms 1836 KB
#include "towers.h"
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using arr = array<int, 2>;
using arrr = array<int, 3>;
constexpr int maxn = 1e5 + 5;
int n;

int pref[maxn] = { 0 };
int h[maxn] = { 0 };

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

    for (int i = 0; i < n; i++) h[i] = H[i];

    if (n < 3) return ;

    if (H[0] < H[1]) pref[0] ++;
    for( int i = 1; i < n - 1;i++) pref[i] += (H[i - 1] > H[i] && H[i] < H[i + 1]);
    if (H[n - 1] < H[n - 2]) pref[n - 1]++;
    for (int i = 1; i < n; i++) pref[i] += pref[i - 1];


    for (int i = 0; i < n; i++) cout << pref[i] << " ";
    cout << "\n";
}

int max_towers(int L, int R, int D) {
    if (R - L < 2) return 1;

    int output = pref[R] - (L != 0 ? pref[L - 1] : 0);
    if (L != 0 && pref[L] == pref[L - 1]) output += (h[L] < h[L + 1]);

    if (R != n - 1 && pref[R] == pref[R - 1]) output += (h[R] < h[R - 1]);

    return output;
}
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1200 KB Execution killed with signal 13
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 Runtime error 10 ms 1836 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 652 KB Execution killed with signal 13
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 Runtime error 6 ms 1200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -