Submission #1073238

#TimeUsernameProblemLanguageResultExecution timeMemory
1073238ivazivaBikeparking (EGOI24_bikeparking)C++14
25 / 100
84 ms5672 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 300001 int n; int x[MAXN],y[MAXN]; int main() { cin>>n; for (int i=0;i<n;i++) cin>>x[i]; for (int i=0;i<n;i++) cin>>y[i]; int ans=0; int pointer=0; for (int i=0;i<n;i++) { while (x[pointer]==0) pointer++; if (pointer>=i) continue; int val=min(x[pointer],y[i]); x[pointer]-=val;y[i]-=val;ans+=val; } for (int i=0;i<n;i++) { int val=min(x[i],y[i]); x[i]-=val;y[i]-=val; } for (int i=0;i<n;i++) ans-=y[i]; cout<<ans<<endl; }
#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...