#include<bits/stdc++.h>
#include<unordered_map>
#include "plants.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define rrep(i,a,b) for(int i=int(a);i>int(b);i--)
#define all(v) v.begin(),v.end()
#define trav(a,v) for(auto&a:v)
#define sz(a) a.size()
typedef long double ld;
using namespace std;
static const long long inf = 1e15;
static const long long infint = 1e9;
typedef long long ll;
typedef unsigned long long ull;
vector<ll> sorted;
void init(int k, std::vector<int> r) {
ll n = r.size();
rep(i, 0, n) {
ll indx = 0;
rrep(j,n-1,-1){
if (r[j] == 0) {
indx = j;
break;
}
}
ll cur = 0;
rep(j, 0, n) {
cur++;
if (r[(indx + j) % n] == 0) {
if (cur > k) {
indx = (j + indx) % n;
break;
}
else cur = 1;
}
}
r[indx] = infint;
sorted.push_back(indx);
indx -= (k-1);
indx += n;
rep(j, 0, k) {
r[(indx + j) % n] -= 1;
}
}
reverse(all(sorted));
}
int compare_plants(int x, int y) {
if (find(all(sorted), x) - find(all(sorted), y) > 0)return 1;
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
14 ms |
412 KB |
Output is correct |
7 |
Correct |
742 ms |
5064 KB |
Output is correct |
8 |
Correct |
3 ms |
300 KB |
Output is correct |
9 |
Correct |
15 ms |
408 KB |
Output is correct |
10 |
Correct |
695 ms |
5076 KB |
Output is correct |
11 |
Correct |
618 ms |
5132 KB |
Output is correct |
12 |
Correct |
707 ms |
5184 KB |
Output is correct |
13 |
Correct |
730 ms |
5060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
14 ms |
412 KB |
Output is correct |
7 |
Correct |
742 ms |
5064 KB |
Output is correct |
8 |
Correct |
3 ms |
300 KB |
Output is correct |
9 |
Correct |
15 ms |
408 KB |
Output is correct |
10 |
Correct |
695 ms |
5076 KB |
Output is correct |
11 |
Correct |
618 ms |
5132 KB |
Output is correct |
12 |
Correct |
707 ms |
5184 KB |
Output is correct |
13 |
Correct |
730 ms |
5060 KB |
Output is correct |
14 |
Execution timed out |
4083 ms |
5408 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
237 ms |
3064 KB |
Output is correct |
4 |
Execution timed out |
4088 ms |
4404 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
216 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |