# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1050074 | 2024-08-09T07:12:32 Z | aykhn | Comparing Plants (IOI20_plants) | C++17 | 25 ms | 3324 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; int cur = -1; while (cur < n) { 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()) break; int ind = -1; if (idx.size() == 1) ind = 0; else { for (int i = 0; i < idx.size(); i++) { if ((idx[(i + 1) % (int)idx.size()] - idx[i] + n) % n >= k) { ind = (i + 1) % (int)idx.size(); break; } } } for (int i = ind; 1;) { a[idx[i]] = ++cur; f[idx[i]] = 1; i = (i + 1) % (int)idx.size(); if (i == ind) break; } for (int k = 0; k < idx.size(); k++) { int ind = idx[k]; for (int j = (ind - 1 + n) % n; j != (ind - k + n) % n && j != idx[(k - 1 + (int)idx.size()) % (int)idx.size()]; 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 | 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 | 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 | 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 | Incorrect | 25 ms | 3324 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 | 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 | 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 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |