# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
359960 | 2021-01-27T11:22:46 Z | Sorting | Comparing Plants (IOI20_plants) | C++17 | 4000 ms | 9580 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 3; int r[N], p[N], k, n; void init(int _k, vector<int> _r) { k = _k; n = _r.size(); for(int i = 0; i < _r.size(); ++i) r[i] = _r[i]; for(int i = n - 1; i >= 0; --i){ int prev = n, idx; bool ok = false; for(int j = n - 1; j >= 0; --j){ if(prev - j >= k && prev != n){ idx = prev; ok = true; break; } if(!r[j]) prev = j; } if(!ok){ for(int j = 0; j <= n - 1; ++j) if(!r[j]){ idx = j; break; } } p[idx] = i; r[idx] = n; for(int j = 1; j <= k - 1; ++j) r[(idx - j + n) % n]--; } } int compare_plants(int x, int y) { return (p[x] > p[y]) ? 1 : -1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Incorrect | 1 ms | 364 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 9 ms | 492 KB | Output is correct |
7 | Correct | 198 ms | 5100 KB | Output is correct |
8 | Correct | 2 ms | 492 KB | Output is correct |
9 | Correct | 8 ms | 492 KB | Output is correct |
10 | Correct | 199 ms | 5228 KB | Output is correct |
11 | Correct | 157 ms | 5100 KB | Output is correct |
12 | Correct | 156 ms | 5296 KB | Output is correct |
13 | Correct | 253 ms | 5100 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 9 ms | 492 KB | Output is correct |
7 | Correct | 198 ms | 5100 KB | Output is correct |
8 | Correct | 2 ms | 492 KB | Output is correct |
9 | Correct | 8 ms | 492 KB | Output is correct |
10 | Correct | 199 ms | 5228 KB | Output is correct |
11 | Correct | 157 ms | 5100 KB | Output is correct |
12 | Correct | 156 ms | 5296 KB | Output is correct |
13 | Correct | 253 ms | 5100 KB | Output is correct |
14 | Correct | 1580 ms | 5740 KB | Output is correct |
15 | Execution timed out | 4049 ms | 9580 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 67 ms | 3284 KB | Output is correct |
4 | Execution timed out | 4027 ms | 8552 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Incorrect | 1 ms | 364 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Incorrect | 1 ms | 364 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Incorrect | 1 ms | 364 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |