Submission #771421

# Submission time Handle Problem Language Result Execution time Memory
771421 2023-07-03T01:08:55 Z PurpleCrayon Radio Towers (IOI22_towers) C++17
14 / 100
783 ms 1892 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;

#define sz(v) int(v.size())
#define ar array
typedef long long ll;
const int N = 1e5+10, MOD = 1e9+7;
const ll INF = 1e18+10;

int n, a[N];
int ps[N];

void init(int _n, vector<int> H) {
    n = _n;
    for (int i = 0; i < n; i++) {
        a[i] = H[i];
    }

    for (int i = 1; i < n-1; i++) {
        if (a[i-1] > a[i] && a[i] < a[i+1]) {
            ps[i] = 1;
        }
    }

    for (int i = 1; i < n; i++) ps[i] += ps[i-1];
}

int max_towers(int l, int r, int d) {
    assert(d == 1);
    if (r - l + 1 <= 2) return 1;
    return ps[r-1] - ps[l] + (a[l] < a[l+1]) + (a[r] < a[r-1]);
}
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1892 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 490 ms 1832 KB Output is correct
2 Correct 560 ms 1856 KB Output is correct
3 Correct 587 ms 1836 KB Output is correct
4 Correct 542 ms 1872 KB Output is correct
5 Correct 659 ms 1872 KB Output is correct
6 Correct 680 ms 1828 KB Output is correct
7 Correct 711 ms 1740 KB Output is correct
8 Correct 722 ms 1852 KB Output is correct
9 Correct 681 ms 1872 KB Output is correct
10 Correct 783 ms 1872 KB Output is correct
11 Correct 585 ms 1832 KB Output is correct
12 Correct 523 ms 1872 KB Output is correct
13 Correct 744 ms 1848 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 0 ms 336 KB Output is correct
17 Correct 9 ms 1844 KB Output is correct
18 Correct 15 ms 1828 KB Output is correct
19 Correct 15 ms 1856 KB Output is correct
20 Correct 9 ms 1736 KB Output is correct
21 Correct 9 ms 1872 KB Output is correct
22 Correct 9 ms 1836 KB Output is correct
23 Correct 9 ms 1844 KB Output is correct
24 Correct 9 ms 1832 KB Output is correct
25 Correct 15 ms 1852 KB Output is correct
26 Correct 9 ms 1836 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 304 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 0 ms 208 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 264 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 0 ms 336 KB Output is correct
36 Correct 0 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1232 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1892 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -