Submission #771411

# Submission time Handle Problem Language Result Execution time Memory
771411 2023-07-03T00:16:54 Z PurpleCrayon Radio Towers (IOI22_towers) C++17
0 / 100
361 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 Incorrect 361 ms 1856 KB 1st lines differ - on the 1st token, expected: '11903', found: '18072'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 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 -