Submission #421980

#TimeUsernameProblemLanguageResultExecution timeMemory
421980MrFranchoComparing Plants (IOI20_plants)C++11
5 / 100
141 ms7912 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 2e5; int pSum[MAXN+1], n; void init(int k, vector<int> r) { n = r.size(); pSum[0] = 0; for(int i = 0; i < n; i++) { pSum[i+1] = pSum[i] + r[i]; } return; } int compare_plants(int x, int y) { if(pSum[y] - pSum[x] == 0 || (pSum[n]-pSum[y] == n-y && pSum[x] == x)) return 1; else if (pSum[y] - pSum[x] == y-x || (pSum[n]-pSum[y] == 0 && pSum[x] == 0)) 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...