Submission #1034305

#TimeUsernameProblemLanguageResultExecution timeMemory
1034305GrayComparing Plants (IOI20_plants)C++17
0 / 100
31 ms4992 KiB
#include "plants.h" #define ll long long #define ff first #define ss second #define ln "\n" using namespace std; vector<int> cast; void init(int k, std::vector<int> r) { int n = (int)r.size(); cast.resize(n); for (ll i=0; i<n; i++){ if (r[i]){ cast[(i+1)%n]=1; }else{ cast[(i+1)%n]=-1; } } for (ll i=1; i<n; i++) cast[i]+=cast[i-1]; if (cast[0]==-1){ for (ll i=0; i<n; i++) cast[i]++; } } int compare_plants(int x, int y) { if (cast[x]>cast[y]) return 1; else if (cast[x]<cast[y]) return -1; else 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...