#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "towers.h"
namespace TEST1 {
bool check(int n, VI h) {
int cnt = 0;
replr(i, 1, n-2) if (h[i] > h[i-1] && h[i] > h[i+1]) cnt++;
return cnt <= 1;
}
int mx = -1;
int mxv = -2e9;
int n;
VI h;
void init(int N, VI H) {
n = N;
h = H;
rep(i, n) if (h[i] > mxv) {
mx = i;
mxv = h[i];
}
}
int max_towers(int l, int r, int D) {
if (l < mx && mx < r) {
if (max(h[l], h[r]) + D <= mxv) return 2;
return 1;
}
return 1;
}
}
int test = -1;
void init(int N, VI H) {
if (TEST1::check(N, H)) test = 1;
}
int max_towers(int l, int r, int D) {
if (test == -1) return -1;
if (test == 1) return TEST1::max_towers(l, r, D);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
279 ms |
936 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
424 KB |
1st lines differ - on the 1st token, expected: '13', found: '-1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
424 KB |
1st lines differ - on the 1st token, expected: '13', found: '-1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
503 ms |
1368 KB |
1st lines differ - on the 1st token, expected: '11903', found: '-1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
201 ms |
600 KB |
1st lines differ - on the 1st token, expected: '7197', found: '-1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
424 KB |
1st lines differ - on the 1st token, expected: '13', found: '-1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
279 ms |
936 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |