#include <bits/stdc++.h>
using namespace std;
#ifndef ARTHUR_LOCAL
#include "plants.h"
#endif
using ll = long long;
#define len(x) int((x).size())
#define ff first
#define ss second
// #ifdef ARTHUR_LOCAL
vector<int> R;
int n;
void init(int k, vector<int> r)
{
R=r;
n=len(R);
return;
}
int compare_plants(int x, int y)
{
int i=x;
bool isinc=0;
bool isdec=0;
while(1)
{
if(i==y) break;
if(R[i]==1) isinc=1;
else isdec=1;
i++;
i%=n;
}
if(!isinc) return 1;
if(!isdec) return -1;
isinc=0;
isdec=0;
i=y;
while(1)
{
if(i==x) break;
if(R[i]==1) isinc=1;
else isdec=1;
i++;
i%=n;
}
if(!isinc) return -1;
if(!isdec) return 1;
return 0;
}
#ifdef ARTHUR_LOCAL
int main()
{
init(3,{0,0,1,1});
cout << compare_plants(0,2) << endl;
}
#endif
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
91 ms |
3192 KB |
Output is correct |
7 |
Execution timed out |
4022 ms |
2936 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
91 ms |
3192 KB |
Output is correct |
7 |
Execution timed out |
4022 ms |
2936 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |