This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define newl '\n'
const ll mod=1000000007;
void solve(){
ll n; cin>>n;
ll sum=0,h,c;
forp(i,1,n){cin>>h;}
forp(i,1,n){cin>>c; sum+=c;}
ll ans=(h*(h+1)*sum*(sum+1))/4; ans%=mod;
cout<<ans<<newl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |