Submission #764112

# Submission time Handle Problem Language Result Execution time Memory
764112 2023-06-23T07:18:33 Z dxz05 Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 3736 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, 1e9, D));
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4035 ms 3736 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 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 4009 ms 1360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4013 ms 464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 4035 ms 3736 KB Time limit exceeded
2 Halted 0 ms 0 KB -