#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 305;
#define REP(i,n) for(int i=0;i<(n);i++)
#define eb emplace_back
#define pb push_back
#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(),a.end()
int n,k;
bool vis[maxn];
bool adj[maxn][maxn];
void init(int _k, std::vector<int> r) {
n = r.size();
k = _k;
int cnt = 0;
while(cnt<n){
vector<int> idx;
REP(j,n) if(!vis[j]){
if(r[j]==0) idx.pb(j);
}
// for(int i:idx){
// cout<<i<<' ';
// }
// cout<<endl;
idx.pb(idx[0]+n);
REP(i,SZ(idx)-1){
if(idx[i+1]-idx[i]>=k){
int t = idx[i+1]%n;
vis[t] = 1;
REP(j,k-1){
int nxt = (t+1+j)%n;
if(!vis[nxt]) adj[t][nxt] = 1;
}
cnt++;
REP(j,k-1){
int pre = (t-j-1+n)%n;
if(!vis[pre]) r[pre]--;
}
}
}
}
REP(j,n) REP(i,n) REP(k,n){
if(adj[i][j]&&adj[j][k]) adj[i][k] = 1;
}
return;
}
int compare_plants(int x, int y) {
if(adj[x][y]) return 1;
else if(adj[y][x]) return -1;
else return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |