#include <bits/stdc++.h>
#include "towers.h"
using namespace std;
const long long inf=1e18;
long long n,a[100069];
void init(int on,vector<int> aa)
{
long long i;
n=on;
for(i=1;i<=n;i++)
{
a[i]=aa[i-1];
}
}
int max_towers(int lb,int rb,int cw)
{
long long i,l=inf,c=0;
lb++;
rb++;
for(i=lb;i<=rb;i++)
{
if(c%2==0)
{
if(a[i]<=l-cw)
{
c++;
l=a[i];
}
else if(a[i]>l)
{
l=a[i];
}
}
else
{
if(a[i]>=l+cw)
{
c++;
l=a[i];
}
else
{
l=a[i];
}
}
}
return (c+1)/2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1085 ms |
1196 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '292', found: '289' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '292', found: '289' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4017 ms |
1860 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2681 ms |
816 KB |
1st lines differ - on the 1st token, expected: '7197', found: '7168' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '292', found: '289' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1085 ms |
1196 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |