#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
vi v;
vi sum;
int n;
void init(int k, vector<int> r){
n = r.size();
//cout<<n<<endl;
sum.resize(n,0);
for(int i=0; i<n; i++){
v.push_back(r[i]);
sum[i]+=v[i];
if(i>0) sum[i]+=sum[i-1];
//cout<<sum[i]<<" ";
}
// cout<<endl;
}
int compare_plants(int x, int y){
ll ans1=0, ans2=0;
ans1=sum[y-1];
//cout<<ans1<<ans2<<endl;
if(x>0) ans1-=sum[x-1];
ans2=sum[n-1]-ans1;
//cout<<ans1<<ans2<<endl;
if(ans1==y-x || ans2==0){
return -1;
}
if(ans1==0 || ans2==n-y+x){
return 1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
31 ms |
4188 KB |
Output is correct |
7 |
Correct |
36 ms |
5840 KB |
Output is correct |
8 |
Correct |
43 ms |
10952 KB |
Output is correct |
9 |
Correct |
49 ms |
10952 KB |
Output is correct |
10 |
Correct |
49 ms |
10960 KB |
Output is correct |
11 |
Correct |
49 ms |
10948 KB |
Output is correct |
12 |
Correct |
44 ms |
10960 KB |
Output is correct |
13 |
Correct |
47 ms |
10952 KB |
Output is correct |
14 |
Correct |
48 ms |
10952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
432 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
31 ms |
4188 KB |
Output is correct |
7 |
Correct |
36 ms |
5840 KB |
Output is correct |
8 |
Correct |
43 ms |
10952 KB |
Output is correct |
9 |
Correct |
49 ms |
10952 KB |
Output is correct |
10 |
Correct |
49 ms |
10960 KB |
Output is correct |
11 |
Correct |
49 ms |
10948 KB |
Output is correct |
12 |
Correct |
44 ms |
10960 KB |
Output is correct |
13 |
Correct |
47 ms |
10952 KB |
Output is correct |
14 |
Correct |
48 ms |
10952 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |