#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a), end(a)
using ar2 = array<int,2>;
const int mxN = (int)5e3+10;
int n, comp[mxN], COMP;
vector<int> adj[mxN];
int deg[mxN], ord[mxN];
int h[mxN];
void init(int k, vector<int> r) {
n = sz(r); k--; int xd = n;
while(1){
bool ok = 0;
for(int i = 0; i < n; i++){
if(r[i]!=0) continue;
bool bad = 0;
{
int tot = k, j = i;
while(tot-- and !bad){
j--; if(j==-1) j=n-1;
if(r[j]==0) bad=1;
}
}
if(bad) continue;
{
int tot = k, j = i;
while(tot-- and !bad){
j--; if(j==-1) j=n-1;
r[j]--;
}
}
h[i]=xd; xd--; r[i]--; ok=1;
}
if(!ok) break;
}
}
int compare_plants(int x, int y) {
return h[x]>h[y]?1:-1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
564 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 |
344 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 |
344 KB |
Output is correct |
6 |
Correct |
3 ms |
604 KB |
Output is correct |
7 |
Correct |
74 ms |
5108 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
3 ms |
604 KB |
Output is correct |
10 |
Correct |
76 ms |
5128 KB |
Output is correct |
11 |
Correct |
52 ms |
5204 KB |
Output is correct |
12 |
Correct |
69 ms |
5456 KB |
Output is correct |
13 |
Correct |
84 ms |
5116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
6 |
Correct |
3 ms |
604 KB |
Output is correct |
7 |
Correct |
74 ms |
5108 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
3 ms |
604 KB |
Output is correct |
10 |
Correct |
76 ms |
5128 KB |
Output is correct |
11 |
Correct |
52 ms |
5204 KB |
Output is correct |
12 |
Correct |
69 ms |
5456 KB |
Output is correct |
13 |
Correct |
84 ms |
5116 KB |
Output is correct |
14 |
Runtime error |
538 ms |
5712 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
34 ms |
5100 KB |
Output is correct |
4 |
Runtime error |
37 ms |
11604 KB |
Execution killed with signal 11 |
5 |
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 |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
564 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |