#include<bits/stdc++.h>
#include "plants.h"
using namespace std;
int n, cd[200005];
void init(int k, vector<int> r)
{
n = r.size();
for(int i = 0; i < n; i++) cd[i+1] = cd[i] + r[i];
}
int compare_plants(int x, int y)
{
x++; y++;
if(cd[y-1] - cd[x-1] == 0 || cd[n]-(cd[y-1]-cd[x-1]) == n-y+x) return 1;
else if(cd[y-1] - cd[x-1] == y-x || cd[n]-(cd[y-1]-cd[x-1]) == 0) return -1;
else return 0;
}
/*int main()
{
int n, k, q;
cin>>n>>k>>q;
vector<int> r(n);
for(int i = 0; i < n; i++) cin>>r[i];
init(k, r);
for(int i = 1; i <= q; i++){
int x, y;
cin>>x>>y;
cout<<compare_plants(x, y)<<'\n';
}
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 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 |
42 ms |
4064 KB |
Output is correct |
7 |
Correct |
38 ms |
5556 KB |
Output is correct |
8 |
Correct |
53 ms |
8016 KB |
Output is correct |
9 |
Correct |
46 ms |
8012 KB |
Output is correct |
10 |
Correct |
56 ms |
8016 KB |
Output is correct |
11 |
Correct |
46 ms |
8016 KB |
Output is correct |
12 |
Correct |
51 ms |
8020 KB |
Output is correct |
13 |
Correct |
44 ms |
8016 KB |
Output is correct |
14 |
Correct |
45 ms |
8016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 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 |
344 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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
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 |
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 |
444 KB |
Output is correct |
4 |
Incorrect |
0 ms |
452 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 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 |
42 ms |
4064 KB |
Output is correct |
7 |
Correct |
38 ms |
5556 KB |
Output is correct |
8 |
Correct |
53 ms |
8016 KB |
Output is correct |
9 |
Correct |
46 ms |
8012 KB |
Output is correct |
10 |
Correct |
56 ms |
8016 KB |
Output is correct |
11 |
Correct |
46 ms |
8016 KB |
Output is correct |
12 |
Correct |
51 ms |
8020 KB |
Output is correct |
13 |
Correct |
44 ms |
8016 KB |
Output is correct |
14 |
Correct |
45 ms |
8016 KB |
Output is correct |
15 |
Correct |
1 ms |
344 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 |
- |