#include "towers.h"
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int ind = -1;
vector <int> h;
void init(int n, vector<int> a) {
h = a;
for (int i = 0; i < n - 1; ++i)
{
if (a[i] > a[i + 1]) {
ind = i;
break;
}
}
}
int max_towers(int L, int R, int D) {
if (R < ind || L > ind) return 1;
if (h[ind] >= (max(h[L], h[R]) + D)) return 2;
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
412 ms |
920 KB |
Output is correct |
2 |
Correct |
731 ms |
1468 KB |
Output is correct |
3 |
Correct |
894 ms |
1436 KB |
Output is correct |
4 |
Correct |
728 ms |
1420 KB |
Output is correct |
5 |
Correct |
764 ms |
1444 KB |
Output is correct |
6 |
Correct |
572 ms |
1420 KB |
Output is correct |
7 |
Correct |
590 ms |
1444 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 |
545 ms |
1456 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 |
213 ms |
556 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 |
412 ms |
920 KB |
Output is correct |
2 |
Correct |
731 ms |
1468 KB |
Output is correct |
3 |
Correct |
894 ms |
1436 KB |
Output is correct |
4 |
Correct |
728 ms |
1420 KB |
Output is correct |
5 |
Correct |
764 ms |
1444 KB |
Output is correct |
6 |
Correct |
572 ms |
1420 KB |
Output is correct |
7 |
Correct |
590 ms |
1444 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 |
- |