#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(a) (a).begin(), (a).end()
#define ll long long
template<typename T>
int len(T &a){
return a.size();
}
int n;
vector<int> h;
int mx = 0;
void init(int N, std::vector<int> H) {
n = N;
h = H;
for(int i = 0; i < n; i ++){
if(h[mx] < h[i]){
mx = i;
}
}
}
int max_towers(int l, int r, int d) {
if(r <= mx || l >= mx){
return 1;
}
return (min(h[mx] - h[r], h[mx] - h[l]) >= d ? 2 : 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
276 ms |
1112 KB |
Output is correct |
2 |
Correct |
619 ms |
1368 KB |
Output is correct |
3 |
Correct |
642 ms |
1368 KB |
Output is correct |
4 |
Correct |
655 ms |
1368 KB |
Output is correct |
5 |
Correct |
602 ms |
1368 KB |
Output is correct |
6 |
Correct |
564 ms |
1368 KB |
Output is correct |
7 |
Correct |
530 ms |
1620 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 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 |
344 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 |
449 ms |
1368 KB |
1st lines differ - on the 1st token, expected: '11903', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
167 ms |
692 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 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 |
276 ms |
1112 KB |
Output is correct |
2 |
Correct |
619 ms |
1368 KB |
Output is correct |
3 |
Correct |
642 ms |
1368 KB |
Output is correct |
4 |
Correct |
655 ms |
1368 KB |
Output is correct |
5 |
Correct |
602 ms |
1368 KB |
Output is correct |
6 |
Correct |
564 ms |
1368 KB |
Output is correct |
7 |
Correct |
530 ms |
1620 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |