Submission #385133

#TimeUsernameProblemLanguageResultExecution timeMemory
385133Ahmadsm2005Comparing Plants (IOI20_plants)C++14
0 / 100
2 ms364 KiB
#include<bits/stdc++.h> //#include "grader.cpp" #include "plants.h" using namespace std; int N,MAT[5001][5001],VIS[5001],SML[5001],LAR[5001]; void init(int k,vector<int>r){ N=r.size(); for(int i=0;i<N;i++) for(int l=0;l<N;l++) MAT[i][l]=0; while(1){ //for(int i=0;i<N;i++)cout<<SML[i]<<' '<<LAR[i]<<endl; for(int i=0;i<N;i++) if(r[i]==LAR[i]&&!VIS[i]){ for(int l=0;l<k;l++){ if(!MAT[i][(l+i)%N]){ MAT[(l+i)%N][i]=1,MAT[i][(l+i)%N]=-1; if((i+l+k-1)%N>=i&&(i+l+k-1)>=N)LAR[(i+l)%N]++; } } VIS[i]=1; goto a; } else if((((k-1)-r[i])==SML[i]&&!VIS[i])){ for(int l=0;l<k;l++){ if(!MAT[i][(l+i)%N]){ MAT[i][(i+l)%N]=1,MAT[(l+i)%N][i]=-1; if((i+l+k-1)%N>=i&&(i+l+k-1)>=N)SML[(l+i)%N]++; } } VIS[i]=1; goto a; } break; a:; } } int compare_plants(int x,int y) { return MAT[x][y]; }
#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...