Submission #1222182

#TimeUsernameProblemLanguageResultExecution timeMemory
1222182kargneqComparing Plants (IOI20_plants)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; vector<int> r; int n, k; void init(int kk, std::vector<int> rr) { r = rr; n = r.size(); k = kk; } bool in_window(int from, int to) { // Returns true if 'to' is in the next k-1 plants after 'from' int dist = (to - from + n) % n; return 1 <= dist && dist <= k-1; } int compare_plants(int x, int y) { if (in_window(x, y)) { if (r[x] == 0) return 1; if (r[x] == k-1) return -1; } if (in_window(y, x)) { if (r[y] == 0) return -1; if (r[y] == k-1) return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...