# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
823913 | 2023-08-13T10:04:33 Z | thimote75 | Comparing Plants (IOI20_plants) | C++14 | 1 ms | 468 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; using idata = vector<int>; void shift (idata &r, int count) { idata h; for (int i = count; i < r.size(); i ++) h.push_back(r[i]); for (int i = 0; i < count; i ++) h.push_back(r[i]); r.swap(h); } idata A; void init(int k, idata r) { int n = r.size(); assert(n < 2 * k); int p0 = - 1; for (int i = 0; i < n; i ++) { if (r[i] == 0) { assert(p0 == -1); p0 = i; } } shift(r, p0 + 1); A.resize(n); for (int v = n - 1; v >= 0; v --) { int p = 0; int m = 1e9; for (int i = 0; i < n; i ++) { if (r[i] >= m) continue ; p = i; m = r[i]; } r[p] = 1e9; for (int g = p - 1; g >= 0 && g > p - k; g --) r[g] --; A[(p + p0 + 1) % n] = v; } return; } int compare_plants(int x, int y) { int del = A[x] - A[y]; if (del == 0) return 0; return del / abs(del); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |