#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
#define rall(s) s.rbegin(), s.rend()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define s second
#define f first
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
vector<int> h;
int n, k = -1;
void init(int N, vector<int> H) {
n = N, h = H;
for (int i = 1; i < n; i++) {
if (h[i] < h[i - 1]) {
k = i - 1;
break;
}
}
}
int max_towers(int l, int r, int d) {
if (k == -1) return 1;
if (k <= l || r <= k) return 1;
if (h[l] > h[k] - d || h[r] > h[k] - d) return 1;
return 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
288 ms |
1112 KB |
Output is correct |
2 |
Correct |
630 ms |
1368 KB |
Output is correct |
3 |
Correct |
633 ms |
1368 KB |
Output is correct |
4 |
Correct |
660 ms |
1368 KB |
Output is correct |
5 |
Correct |
682 ms |
1368 KB |
Output is correct |
6 |
Correct |
548 ms |
1368 KB |
Output is correct |
7 |
Correct |
587 ms |
1368 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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
436 ms |
1368 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
213 ms |
688 KB |
1st lines differ - on the 1st token, expected: '7197', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
288 ms |
1112 KB |
Output is correct |
2 |
Correct |
630 ms |
1368 KB |
Output is correct |
3 |
Correct |
633 ms |
1368 KB |
Output is correct |
4 |
Correct |
660 ms |
1368 KB |
Output is correct |
5 |
Correct |
682 ms |
1368 KB |
Output is correct |
6 |
Correct |
548 ms |
1368 KB |
Output is correct |
7 |
Correct |
587 ms |
1368 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 |
- |