Submission #1058196

#TimeUsernameProblemLanguageResultExecution timeMemory
1058196Szymon_PilipczukBikeparking (EGOI24_bikeparking)C++17
25 / 100
79 ms2756 KiB
#include <iostream> using namespace std; int main() { int n; cin>>n; int slots[n]; int people[n]; int population = 0; for(int i = 0;i<n;i++) { cin>>slots[i]; } for(int i = 0;i<n;i++) { cin>>people[i]; population+=people[i]; } int free = 0; int rating = 0; int u; for(int i = 0;i<n;i++) { population -= people[i]; u = min(free,people[i]); free -=u; people[i]-=u; rating+=u; if(slots[i]>population) { free= population; rating -=max(people[i]-(slots[i]-population),0); } else { free+=slots[i]; rating-=people[i]; } } cout<<rating; }
#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...