# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1049996 | 2024-08-09T06:42:31 Z | aykhn | Comparing Plants (IOI20_plants) | C++17 | 159 ms | 8416 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; const int MXN = 5e3 + 5; int n; int a[MXN], cnt[MXN], f[MXN]; void init(int k, vector<int> r) { n = r.size(); for (int i = 0; i < n; i++) cnt[i] = k - 1; for (int i = 0; i < n; i++) { vector<int> idx; for (int i = 0; i < n; i++) { if (f[i]) continue; if (r[i] == cnt[i]) idx.push_back(i); } if (idx.empty()) { while (1); } int ind = -1; if (idx.size() == 1) ind = idx[0]; else { for (int i = 0; i < idx.size(); i++) { if ((idx[(i + 1) % (int)idx.size()] - idx[i] + n) % n >= k) { ind = idx[(i + 1) % (int)idx.size()]; break; } } } if (ind == -1) break; assert(ind != -1); a[ind] = i; f[ind] = 1; for (int j = (ind - 1 + n) % n; j != (ind - k + n) % n; j = (j - 1 + n) % n) cnt[j]--; } } int compare_plants(int x, int y) { return (a[x] > a[y] ? 1 : -1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 5 ms | 348 KB | Output is correct |
7 | Correct | 119 ms | 3132 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 4 ms | 348 KB | Output is correct |
10 | Correct | 114 ms | 3128 KB | Output is correct |
11 | Correct | 89 ms | 3072 KB | Output is correct |
12 | Correct | 159 ms | 3396 KB | Output is correct |
13 | Correct | 129 ms | 3148 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 5 ms | 348 KB | Output is correct |
7 | Correct | 119 ms | 3132 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 4 ms | 348 KB | Output is correct |
10 | Correct | 114 ms | 3128 KB | Output is correct |
11 | Correct | 89 ms | 3072 KB | Output is correct |
12 | Correct | 159 ms | 3396 KB | Output is correct |
13 | Correct | 129 ms | 3148 KB | Output is correct |
14 | Runtime error | 21 ms | 5720 KB | Execution killed with signal 11 |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 32 ms | 3160 KB | Output is correct |
4 | Runtime error | 33 ms | 8416 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |