Submission #1015031

#TimeUsernameProblemLanguageResultExecution timeMemory
1015031u_suck_oComparing Plants (IOI20_plants)C++17
5 / 100
68 ms8272 KiB
#include "bits/stdc++.h" #include "plants.h" #define MAXN 200005 using namespace std; int pref[MAXN]; int n; void init(int k, vector<int> r) { n = r.size(); pref[0] = r[0]; for (int i = 1; i < n; i++) pref[i] = pref[i-1] + r[i]; return; } int compare_plants(int x, int y) { if (x == 0) { if (pref[y-1] == 0) return 1; if (pref[y-1] == y) return -1; if (pref[n-1] - pref[y-1] == n-y) return 1; if (pref[n-1] - pref[y-1] == 0) return -1; } else { if (pref[y-1] - pref[x-1] == 0) return 1; if (pref[y-1] - pref[x-1] == y-x) return -1; if (pref[n-1] - pref[y-1] == n-y && pref[x-1] == x) return 1; if (pref[n-1] - pref[y-1] == 0 && pref[x-1] == 0) 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...