#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define ll long long
#define pb push_back
#define s second
#define f first
#define pf push_front
#define inf 100000000000000000
#define bitebi __builtin_popcountll
#define FOR( i , n ) for( int i = 0 ; i < n ; i ++ )
#define YES cout <<"YES\n"
#define NO cout << "NO\n"
#define debug cout << "Here Fine" << endl ;
#define pr pair < int , int >
#define fbo find_by_order // returns iterator
#define ook order_of_key // returns strictly less numbers than key
using namespace std ;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const double Pi=acos(-1.0);
const double EPS=1E-8;
const int mod = 1000000007 ;
const int mod1 = 998244353 ;
const int NN = 2e5 + 10 ;
mt19937 R(time(0));
map < int , int > ma , ma1 ;
#include "plants.h"
int tt = 2 ;
vector < int > v ;
int case1( int x , int y ){
int n = v.size() ;
int cc = 0 ;
if( x < y ){
if( x == 0 && y != n - 1 && y != 1 ) return 0 ;
if( x == 0 && y == n - 1 ){
if( v[ y ] == 0 ) return -1 ;
else return 1 ;
}
if( x + 1 != y ) return 0 ;
if( v[ x ] == 0 ) return 1 ;
else return -1 ;
}
swap( x , y ) ;
if( x == 0 && y != n - 1 && y != 1 ) return 0 ;
if( x == 0 && y == n - 1 ){
if( v[ y ] == 0 ) return 1 ;
else return -1 ;
}
if( x + 1 != y ) return 0 ;
if( v[ x ] == 0 ) return -1 ;
else return 1 ;
}
int case2( int x , int y ){
return 0 ;
}
void init(int k, std::vector<int> r){
tt = k ;
if( k == 2 ){
v = r ; return ;
}
}
int compare_plants(int x, int y){
if( tt == 2 ) return case1( x , y ) ;
else return case2( x , y ) ;
}
// static int n, k, q;
// static std::vector<int> r;
// static std:: vector<int> x;
// static std:: vector<int> y;
// static std:: vector<int> answer;
// int main() {
// assert(scanf("%d%d%d", &n, &k, &q) == 3);
// r.resize(n);
// answer.resize(q);
// for (int i = 0; i < n; i++) {
// int value;
// assert(scanf("%d", &value) == 1);
// r[i] = value;
// }
// x.resize(q);
// y.resize(q);
// for (int i = 0; i < q; i++) {
// assert(scanf("%d%d", &x[i], &y[i]) == 2);
// }
// init(k, r);
// for (int i = 0; i < q; i++) {
// answer[i] = compare_plants(x[i], y[i]);
// }
// for (int i = 0; i < q; i++) {
// printf("%d\n", answer[i]);
// }
// return 0;
// }
Compilation message
plants.cpp: In function 'int case1(int, int)':
plants.cpp:39:9: warning: unused variable 'cc' [-Wunused-variable]
39 | int cc = 0 ;
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
304 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
300 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
304 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |