제출 #1121405

#제출 시각아이디문제언어결과실행 시간메모리
1121405ezzzayBikeparking (EGOI24_bikeparking)C++14
0 / 100
58 ms8548 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back const int N=3e5+5; int x[N],y[N]; int cnt[N]; signed main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>x[i]; } for(int i=1;i<=n;i++){ cin>>y[i]; } int ans=0; for(int i=n;i>=1;i--){ cnt[i]+=y[i]; int k=min(x[i-1],cnt[i]); ans+=k; cnt[i]-=k; cnt[i-1]+=cnt[i]; } ans-=cnt[1]; cout<<ans; }
#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...