Submission #431019

#TimeUsernameProblemLanguageResultExecution timeMemory
431019PbezzComparing Plants (IOI20_plants)C++14
5 / 100
93 ms5736 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back typedef pair<ll,ll> pii; const ll MAXN = 2e5+5; const ll INF = 1e9+7; ll presum[MAXN],n; void init(int k, std::vector<int> r) { ll i; n=(ll)r.size(); presum[0]=0; for(i=1;i<=n;i++){ presum[i]=presum[i-1]+r[i-1]; } return; } int compare_plants(int x, int y) { x++; y++; ll k = presum[y-1]-presum[x-1]; // cout<<"first"<<k<<"\n"; if(k==0){return 1; } if(k==y-x){return -1; } k = presum[n]-presum[y-1]; k += presum[x-1]; // cout<<"second "<<k<<endl; if(k==0){return -1; } if(k==n-(y-x)){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...