Submission #421034

#TimeUsernameProblemLanguageResultExecution timeMemory
421034MonchitoComparing Plants (IOI20_plants)C++14
0 / 100
1 ms204 KiB
#include <iostream> #include <vector> using namespace std; int K, N; vector<int> R, pref; void init(int k, vector<int> r){ K = k; R = r; N = (int)r.size(); pref = vector<int>(N+1, 0); for(int i=1; i<=N; i++) pref[i] = pref[i-1] + r[i-1]; } int compare_plants(int x, int y){ int sum = pref[y] - pref[x+1]; if(x == 0 && sum == 0) return 1; if(x == 1 && sum == y-x-1) return -1; sum = pref[N] - pref[y+1] + pref[x]; if(y == 0 && sum == 0) return -1; if(y == 1 && sum == N-(y+1) + x) return 1; 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...