Submission #1081835

#TimeUsernameProblemLanguageResultExecution timeMemory
1081835woodComparing Plants (IOI20_plants)C++17
0 / 100
1 ms376 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; #define vi vector<int> vi pref; int n; void init(int k, std::vector<int> r) { n = r.size(); pref.resize(n+1); for(int i = 0; i<n; i++) pref[i+1] = pref[i]+r[i]; } int compare_plants(int x, int y) { int p = 1; if(x>y) { p = -1; swap(x,y); } if(pref[y]-pref[x]==0||pref[n]-pref[y+1]+pref[x]==n+x-y) return p; if(pref[y]-pref[x]==y-x||pref[n]-pref[y+1]+pref[x]==0) return -p; 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...