Submission #836201

# Submission time Handle Problem Language Result Execution time Memory
836201 2023-08-24T08:41:25 Z tengiz05 Radio Towers (IOI22_towers) C++17
4 / 100
701 ms 2124 KB
#include "towers.h"

#include <bits/stdc++.h>
using namespace std;

vector<int> A, B, H;
int k;
int n;
void init(int N, vector<int> h) {
    n = N;
    k = n - 1;
    H = h;
    for (int i = 0; i < n - 1; i++) {
        if (h[i] < h[i + 1]) {
            A.push_back(h[i]);
        } else {
            k = i;
            break;
        }
    }
    for (int i = n - 1; i > 0; i--) {
        if (h[i] < h[i - 1]) {
            B.push_back(h[i]);
        }
    }
}

int max_towers(int L, int R, int D) {
    int l = upper_bound(A.begin(), A.end(), H[k] - D) - A.begin();
    int r = upper_bound(B.begin(), B.end(), H[k] - D) - B.begin();
    r = n - r;
    int a = max(0, l - L);
    int b = max(0, R - r + 1);
    if (a > 0 && b > 0) {
        return 2;
    } else {
        return 1;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 282 ms 1360 KB Output is correct
2 Correct 638 ms 2100 KB Output is correct
3 Correct 657 ms 2100 KB Output is correct
4 Correct 681 ms 2124 KB Output is correct
5 Correct 640 ms 2068 KB Output is correct
6 Correct 701 ms 2084 KB Output is correct
7 Correct 630 ms 2100 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 625 ms 1844 KB 1st lines differ - on the 1st token, expected: '11903', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 259 ms 592 KB 1st lines differ - on the 1st token, expected: '7197', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 282 ms 1360 KB Output is correct
2 Correct 638 ms 2100 KB Output is correct
3 Correct 657 ms 2100 KB Output is correct
4 Correct 681 ms 2124 KB Output is correct
5 Correct 640 ms 2068 KB Output is correct
6 Correct 701 ms 2084 KB Output is correct
7 Correct 630 ms 2100 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
12 Halted 0 ms 0 KB -