Submission #764113

# Submission time Handle Problem Language Result Execution time Memory
764113 2023-06-23T07:19:15 Z dxz05 Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 3664 KB
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("avx,avx2")

#include "towers.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> a;
void init(int N, vector<int> H) {
    a = H;
}

int calc(int l, int r, int h, int d){
    if (l > r) return 0;
    if (r - l + 1 <= 2) return a[l] <= h || a[r] <= h;

    int m = l;
    for (int i = l; i <= r; i++){
        if (a[i] > a[m]) m = i;
    }

    return calc(l, m - 1, a[m] - d, d) + calc(m + 1, r, a[m] - d, d);
}

int max_towers(int L, int R, int D) {
    return max(1, calc(L, R, 2e9, D));
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4046 ms 3664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '292', found: '268'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '292', found: '268'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4050 ms 1436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4099 ms 464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '292', found: '268'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4046 ms 3664 KB Time limit exceeded
2 Halted 0 ms 0 KB -