# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
814694 | 2023-08-08T09:02:48 Z | vjudge1 | Comparing Plants (IOI20_plants) | C++17 | 0 ms | 0 KB |
#include "plants.h" #include <bits/stdc++.h> #include "grader.cpp" using namespace std; #define pb push_back #define mp make_pair typedef long long ll; typedef pair<long long, long long> pll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<long long> vl; int n, K; vi cmp; void init(int k, vector<int> r) { n = (int)r.size(); K = k; cmp = r; } int compare_plants(int x, int y) { if(K == 2){ if(abs(x-y) > 1) return 0; if(x > y){ if(cmp[y] == 1) return -1; else return 1; } else{ if(cmp[x] == 1) return -1; else return 1; } } }