Submission #1084477

#TimeUsernameProblemLanguageResultExecution timeMemory
1084477khanhphucscratchComparing Plants (IOI20_plants)C++14
5 / 100
56 ms8020 KiB
#include<bits/stdc++.h> #include "plants.h" using namespace std; int n, cd[200005]; void init(int k, vector<int> r) { n = r.size(); for(int i = 0; i < n; i++) cd[i+1] = cd[i] + r[i]; } int compare_plants(int x, int y) { x++; y++; if(cd[y-1] - cd[x-1] == 0 || cd[n]-(cd[y-1]-cd[x-1]) == n-y+x) return 1; else if(cd[y-1] - cd[x-1] == y-x || cd[n]-(cd[y-1]-cd[x-1]) == 0) return -1; else return 0; } /*int main() { int n, k, q; cin>>n>>k>>q; vector<int> r(n); for(int i = 0; i < n; i++) cin>>r[i]; init(k, r); for(int i = 1; i <= q; i++){ int x, y; cin>>x>>y; cout<<compare_plants(x, y)<<'\n'; } } */
#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...