Submission #1002083

#TimeUsernameProblemLanguageResultExecution timeMemory
1002083alecurseFancy Fence (CEOI20_fancyfence)C++17
30 / 100
57 ms2904 KiB
#include <bits/stdc++.h> #define ll long long int using namespace std; ll mod = 1e9+7; int main() { ll N; cin>>N; vector<ll> h(N+1), w(N+1),dpf(N+1); ll res=0; for(ll i=1;i<=N;i++) { cin>>h[i]; } for(ll i=1;i<=N;i++) { cin>>w[i]; } for(ll i=1;i<=N;i++) { ll sum=h[i]*(h[i]+(ll)1)/(ll)2; ll sumw=w[i]*(w[i]+(ll)1)/(ll)2; sum%=mod; sumw%=mod; dpf[i]=(sum*w[i])%mod+dpf[i-1]; dpf[i]%=mod; res+=(sum*sumw)%mod; res+=(dpf[i-1]*w[i])%mod; res%=mod; } cout<<res; }
#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...