#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define sz(x) (ll)x.size()
#define F first
#define S second
#define pb push_back
#define MID ((l+r)/2)
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
#define dbg5(x,y,z,a,b) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<" "<<#a<<": "<<a<<" "<<#b<<": "<<b<<endl;
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;
typedef pair<ii,ii> i4;
typedef pair <ll, i4> i5;
void printVct(vi &v, string s = ""){
cout<<s<<": ";
for (ll i=0; i<sz(v); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
ll k;
ll n;
vi v;
void init(int N, vi H){
n = N;
v = H;
k =1;
while (k<n && v[k] > v[k-1]){
k++;
}
k--;
// dbg(k);
}
int max_towers(int l, int r, int d){
ll a =0, b= 0, val = v[k]-d;
for (ll i=l; i<k; i++){
if (val >= v[i]) a++;
}
for (ll i =k+1; i<n; i++){
if (val >= v[i]) b++;
}
// dbg5(a,b, val, v[k], k);
return min(a,b);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1598 ms |
976 KB |
1st lines differ - on the 1st token, expected: '1', found: '8071' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4086 ms |
1360 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2001 ms |
552 KB |
1st lines differ - on the 1st token, expected: '7197', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1598 ms |
976 KB |
1st lines differ - on the 1st token, expected: '1', found: '8071' |
2 |
Halted |
0 ms |
0 KB |
- |