제출 #613768

#제출 시각아이디문제언어결과실행 시간메모리
613768Koosha_mv식물 비교 (IOI20_plants)C++14
11 / 100
92 ms23252 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; #define dbgv(v) cout<<#v<<" = "; f(i,0,int(v.size())) cout<<v[i]<<" "; cout<<endl #define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl #define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl #define eror(x) cout<<#x<<'='<<(x)<<endl #define f_(i,a,b) for(int i=a;i>=b;i--) #define f(i,a,b) for(int i=a;i<b;i++) #define nb(x) __builtin_popcount(x) #define all(v) v.begin(),v.end() #define bit(n,k) (((n)>>(k))&1) #define Add(x,y) x=(x+y)%mod #define maxm(a,b) a=max(a,b) #define minm(a,b) a=min(a,b) #define lst(x) x[x.size()-1] #define sz(x) int(x.size()) #define mp make_pair #define ll long long #define pb push_back #define S second #define F first const int N=505; int n,k,p[N],a[N],vis[N][N]; vector<int> g[N]; void dfs1(int u,int rt){ vis[rt][u]=1; for(auto v : g[u]){ if(vis[rt][v]) continue ; dfs1(v,rt); } } void init(int _k,vector<int> _p) { n=_p.size(),k=_k; f(i,0,n) p[i]=_p[i]; int last=0; f_(T,n-1,0){ f(i,0,2*n){ if(p[i%n]==0){ if(i>=n && i-last>=k){ a[i-n]=T; f(j,0,k){ p[(i-j)%n]--; } break ; } last=i; } } } f(i,0,n){ f(j,1,k){ if(a[i]<a[(i+j)%n]){ g[i].pb((i+j)%n); } else{ g[(i+j)%n].pb(i); } } } f(i,0,n){ dfs1(i,i); } } int compare_plants(int x, int y) { if(vis[x][y]) return -1; if(vis[y][x]) return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...