Submission #528207

#TimeUsernameProblemLanguageResultExecution timeMemory
528207HappyPacManComparing Plants (IOI20_plants)C++14
14 / 100
4040 ms8704 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 8; int N,K; int tmp[maxn],arr[maxn],indexing; void init(int k, std::vector<int> r){ N = r.size(); K = k; indexing = N; for(int i=0;i<N;i++){ for(int j=0;j<N;j++){ if(r[j] == 0){ bool valid = true; for(int k=1-K;k<0;k++){ if(r[(j+k+N)%N] == 0) valid = false; } if(valid){ for(int k=1-K;k<=0;k++){ r[(j+k+N)%N]--; } arr[j] = indexing--; break; } } } } } int compare_plants(int x, int y){ if(arr[x] < arr[y]) return -1; return 1; }
#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...