#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;
ll n, k;
vll ve;
void init (int n, vi ve) {
::n = n;
k = 0;
::ve = vll(ve.begin(), ve.end());
while (ve[k] < ve[k+1]) k++;
}
int max_towers (int ql, int qr, int d) {
if (k <= ql || qr <= k) return 1;
if (ve[ql] <= ve[k]-d && ve[qr] <= ve[k]-d) return 2;
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
247 ms |
1368 KB |
Output is correct |
2 |
Correct |
666 ms |
1880 KB |
Output is correct |
3 |
Correct |
644 ms |
1852 KB |
Output is correct |
4 |
Correct |
608 ms |
1880 KB |
Output is correct |
5 |
Correct |
572 ms |
1856 KB |
Output is correct |
6 |
Correct |
587 ms |
1880 KB |
Output is correct |
7 |
Correct |
582 ms |
1852 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
1 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 |
408 ms |
1880 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 |
163 ms |
600 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 |
1 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 |
247 ms |
1368 KB |
Output is correct |
2 |
Correct |
666 ms |
1880 KB |
Output is correct |
3 |
Correct |
644 ms |
1852 KB |
Output is correct |
4 |
Correct |
608 ms |
1880 KB |
Output is correct |
5 |
Correct |
572 ms |
1856 KB |
Output is correct |
6 |
Correct |
587 ms |
1880 KB |
Output is correct |
7 |
Correct |
582 ms |
1852 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |