#include <bits/stdc++.h>
using namespace std;
vector<int> h;
void init(int k, std::vector<int> r) {
int n = r.size();
h.resize(n);
vector<bool> taken(n);
for(int ht=n;ht;ht--){
for(int i=0;i<n;i++){
if(r[i]!=0)continue;
bool works = true;
int j=i;
for(int len=1;len<k;len++){
j=(j-1+n)%n;
if(r[j]==0)works=false;
}
if(works){
h[i]=ht;
int j=i;
for(int len=1;len<k;len++){
j=(j-1+n)%n;
r[j]--;
}
r[i] = n+1;
break;
} else {
i+=k-1;
}
}
}
}
int compare_plants(int x, int y) {
if(h[x]>h[y])return 1;
else return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 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 |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
7 ms |
544 KB |
Output is correct |
7 |
Correct |
185 ms |
5204 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
7 ms |
344 KB |
Output is correct |
10 |
Correct |
192 ms |
5200 KB |
Output is correct |
11 |
Correct |
129 ms |
4948 KB |
Output is correct |
12 |
Correct |
129 ms |
5248 KB |
Output is correct |
13 |
Correct |
220 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 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 |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
7 ms |
544 KB |
Output is correct |
7 |
Correct |
185 ms |
5204 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
7 ms |
344 KB |
Output is correct |
10 |
Correct |
192 ms |
5200 KB |
Output is correct |
11 |
Correct |
129 ms |
4948 KB |
Output is correct |
12 |
Correct |
129 ms |
5248 KB |
Output is correct |
13 |
Correct |
220 ms |
4988 KB |
Output is correct |
14 |
Correct |
1679 ms |
5488 KB |
Output is correct |
15 |
Execution timed out |
4024 ms |
8668 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
34 ms |
4964 KB |
Output is correct |
4 |
Execution timed out |
4035 ms |
8020 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 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 |
- |