// komak!
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << "(" << (#x) << "): " << (x) << endl;
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn5 = 1e5 + 10;
int mxid, h[maxn5];
void init(int n, std::vector<int> H) {
mxid = 0;
for(int i = 0; i < n; i++){
h[i] = H[i];
if(h[i] > h[mxid])
mxid = i;
}
}
int max_towers(int l, int r, int d) {
return (l < mxid && r > mxid && h[l] + d <= h[mxid] && h[r] + d <= h[mxid]) + 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
340 ms |
936 KB |
Output is correct |
2 |
Correct |
713 ms |
1448 KB |
Output is correct |
3 |
Correct |
576 ms |
1360 KB |
Output is correct |
4 |
Correct |
778 ms |
1360 KB |
Output is correct |
5 |
Correct |
656 ms |
1360 KB |
Output is correct |
6 |
Correct |
446 ms |
1452 KB |
Output is correct |
7 |
Correct |
576 ms |
1356 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
1 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 |
474 ms |
1468 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 |
185 ms |
464 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 |
1 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 |
340 ms |
936 KB |
Output is correct |
2 |
Correct |
713 ms |
1448 KB |
Output is correct |
3 |
Correct |
576 ms |
1360 KB |
Output is correct |
4 |
Correct |
778 ms |
1360 KB |
Output is correct |
5 |
Correct |
656 ms |
1360 KB |
Output is correct |
6 |
Correct |
446 ms |
1452 KB |
Output is correct |
7 |
Correct |
576 ms |
1356 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |