Submission #1010753

#TimeUsernameProblemLanguageResultExecution timeMemory
1010753gaurezzzComparing Plants (IOI20_plants)C++17
5 / 100
55 ms8044 KiB
#include <bits/stdc++.h> #define F first #define S second #define ll long long #define nd '\n' using namespace std; vector <int> prefix; ll n=0; void init (int k, vector <int> r){ n = r.size(); prefix.assign(n,0); prefix[0]=r[0]; for (ll i=1; i<n; i++){ prefix[i] = prefix[i-1] + r[i]; } return; } int compare_plants(int x, int y){ ll c = prefix[y-1]; if (x != 0) c-=prefix[x-1]; if (c == y-x) return -1; else if (c == 0) return 1; c = prefix[n-1] - prefix[y-1]; c+= prefix[x-1]; if (c == n-y+x) return 1; else if (c == 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...