Submission #623049

#TimeUsernameProblemLanguageResultExecution timeMemory
623049SifferComparing Plants (IOI20_plants)C++14
5 / 100
93 ms10316 KiB
#include "plants.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second vector<pair<int,int>> v, d; int n; void init(int p, vector<int> r) { n = r.size(); int s = 0; for(;r[s]; s++); s++; v.resize(n); d.resize(n); int b = s; int k = 0; for(int i = 0; i < n; i++) { v[(s+i)%n] = {b, k++}; if(r[(s+i)%n] == 0) b = s+i+1, k = 0; } s = 0; for(;r[s]-1; s++); s++; b = s; k = 0; for(int i = 0; i < n; i++) { d[(s+i)%n] = {b, k++}; if(r[(s+i)%n]) b = s+i+1, k = 0; } } int compare_plants(int x, int y) { if(v[x].F != v[y].F) { if(d[x].F != d[y].F) return 0; if(d[x].S > d[y].S) return -1; return 1; } if(v[x].S > v[y].S) 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...