#include "towers.h" //sub1
#include <bits/stdc++.h>
using namespace std;
vector<int> he;
int k=-1,n;
void init (int ne,vector<int> h)
{
n=ne;
he.resize(n);
for(int x=0;x<n;x++)
{
he[x]=h[x];
if(h[x]>h[x+1] && x!=n && k==-1)
k=x;
}
if(h[n-1]>h[n-2])
k=n-1;
}
int max_towers(int l, int r, int d)
{
if(l==r)
return 1;
if(l>k || r<k)
return 1;
int ans=0;
for(int x=l;x<k;x++)
{
if(he[x]<=he[k]-d && he[r]<=he[k]-d)
ans++;
}
for(int x=r;x>k;x--)
{
if(he[x]<=he[k]-d && he[l]<=he[k]-d)
ans++;
}
return max(ans,1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
538 ms |
976 KB |
12th lines differ - on the 1st token, expected: '2', found: '35365' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 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 |
1 ms |
208 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 |
608 ms |
1320 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2064 ms |
552 KB |
1st lines differ - on the 1st token, expected: '7197', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 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 |
538 ms |
976 KB |
12th lines differ - on the 1st token, expected: '2', found: '35365' |
2 |
Halted |
0 ms |
0 KB |
- |