Submission #1053012

#TimeUsernameProblemLanguageResultExecution timeMemory
1053012LudisseyBikeparking (EGOI24_bikeparking)C++17
25 / 100
29 ms10068 KiB
#include <bits/stdc++.h> #define int long long #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() using namespace std; int N,M,Q; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> N; vector<int> x(N),y(N); vector<int> kp(N); for (int i = 0; i < N; i++) cin >> x[i]; for (int i = 0; i < N; i++) cin >> y[i]; int j=0; int sm=0; for (int i = 0; i < N; i++) { while(j<i&&y[i]>0 ) { int df=min(x[j],y[i]); x[j]-=df; y[i]-=df; sm+=df; if(x[j]==0) j++; } kp[i]+=y[i]; } for (int i = 0; i < N; i++){ int df=min(x[i],kp[i]); x[i]-=df; kp[i]-=df; sm-=kp[i]; } cout << sm << "\n"; 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...