Submission #779394

#TimeUsernameProblemLanguageResultExecution timeMemory
779394jasminComparing Plants (IOI20_plants)C++17
0 / 100
1 ms296 KiB
#include "plants.h" #include<bits/stdc++.h> using namespace std; vector<int> ps; //anzahl kleiner zeichen void init(int k, std::vector<int> r) { int n=r.size(); ps.assign(n+1, 0); for(int i=0; i<n; i++){ ps[i+1] = ps[i] + r[i]; } } int compare_plants(int x, int y) { if(x<y){ int ssum = ps[y] - ps[x]; if(ssum == y-x){ return -1; } else if(ssum==0){ return 1; } else{ return 0; } } else{ int ssum = ps[x] - ps[y]; if(ssum == x-y){ return 1; } else if(ssum==0){ return -1; } else{ return 0; } } 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...