// AM + DG
#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vpi> vvpi;
typedef vector<vpll> vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef short int si;
typedef vector<si> vsi;
typedef vector<vsi> vvsi;
#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++)
#define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--)
#define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++)
#define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--)
#define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci
#define fi first
#define se second
#define pb push_back
#define INF(type) numeric_limits<type>::max()
#define NINF(type) numeric_limits<type>::min()
#define TCASES int t; cin >> t; while(t--)
int n;
vi h;
int mxv;
int mxvi;
void init(int N, vi H) {
n = N;
h = H;
mxv = NINF(int);
mxvi = 0;
for(int i = 0; i < N; i++) {
if(h[i] > mxv) {
mxv = h[i];
mxvi = i;
}
}
}
int max_towers(int L, int R, int D) {
return (L <= mxvi && mxvi <= R && mxv - max(h[L], h[R]) >= D ? 2 : 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
291 ms |
1112 KB |
Output is correct |
2 |
Correct |
636 ms |
1368 KB |
Output is correct |
3 |
Correct |
577 ms |
1624 KB |
Output is correct |
4 |
Correct |
592 ms |
1368 KB |
Output is correct |
5 |
Correct |
602 ms |
1368 KB |
Output is correct |
6 |
Correct |
570 ms |
1368 KB |
Output is correct |
7 |
Correct |
608 ms |
1596 KB |
Output is correct |
8 |
Correct |
1 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 |
0 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 |
0 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 |
492 ms |
1368 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 |
157 ms |
696 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 |
0 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 |
291 ms |
1112 KB |
Output is correct |
2 |
Correct |
636 ms |
1368 KB |
Output is correct |
3 |
Correct |
577 ms |
1624 KB |
Output is correct |
4 |
Correct |
592 ms |
1368 KB |
Output is correct |
5 |
Correct |
602 ms |
1368 KB |
Output is correct |
6 |
Correct |
570 ms |
1368 KB |
Output is correct |
7 |
Correct |
608 ms |
1596 KB |
Output is correct |
8 |
Correct |
1 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 |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |