// In the name of Allah
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define len(x) ((ll) (x).size())
#define Mp make_pair
#define pb push_back
#define endl '\n'
#define sep ' '
const int maxn = 1e5 + 7;
const ll oo = 1e9 + 7;
int n, j;
ll A[maxn];
void init(int N, vector<int> H) {
n = N;
for (int i = 0; i < n; i++) A[i] = H[i];
j = max_element(A, A + n) - A;
}
int max_towers(int L, int R, int D) {
if (j >= L && j <= R) {
if (A[L] <= A[j] - D && A[R] <= A[j] - D) return 2;
else return 1;
}
else return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
236 ms |
1368 KB |
Output is correct |
2 |
Correct |
479 ms |
1880 KB |
Output is correct |
3 |
Correct |
522 ms |
1880 KB |
Output is correct |
4 |
Correct |
497 ms |
1880 KB |
Output is correct |
5 |
Correct |
611 ms |
1880 KB |
Output is correct |
6 |
Correct |
482 ms |
1880 KB |
Output is correct |
7 |
Correct |
461 ms |
1880 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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
418 ms |
1880 KB |
1st lines differ - on the 1st token, expected: '11903', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
151 ms |
600 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
236 ms |
1368 KB |
Output is correct |
2 |
Correct |
479 ms |
1880 KB |
Output is correct |
3 |
Correct |
522 ms |
1880 KB |
Output is correct |
4 |
Correct |
497 ms |
1880 KB |
Output is correct |
5 |
Correct |
611 ms |
1880 KB |
Output is correct |
6 |
Correct |
482 ms |
1880 KB |
Output is correct |
7 |
Correct |
461 ms |
1880 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 |
- |