# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
805668 | 2023-08-03T19:48:42 Z | Jkap | Comparing Plants (IOI20_plants) | C++14 | 1 ms | 308 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define si unordered_set<int> #define vi vector<int> int di[200005]; int ri[200005]; void init(int k, vi r) { int x, n = r.size(); for (int i=n-1; i>=0; i--) { if (r[i] != r[n-1]) { x = i+1; break; } } int curr = x; for (int i=x+n-1; i>=x; i--) { if (r[i%n] == r[curr]) { curr = (i+1) %n; } di[i%n] = curr; ri[i%n] = r[i%n]; } } int compare_plants(int x, int y) { int a = min(x, y), b = max(x, y), out=-1; if (di[a] >= b) { out = 1-ri[a]; } else if (di[b] < b && di[b] >=a) { out = 1-ri[b]; } if (out == -1) { return 0; } if (y==a) { out = 1-out; } if (out == 0) { out --; } return out; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 304 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 308 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 304 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |