This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
using namespace std;
const long long MOD=1e9+7;
int main() {
long long n;
cin>>n;
vector<long long> h(n);
long long wossz=0, ans=0;
for(long long i=0; i<n; i++){
cin>>h[i];
}
vector<long long> ket;
for(long long i=0; i<n; i++){
long long a;
cin>>a;
wossz+=a;
ans=a*(a+1)%MOD;
}
ans+=(wossz*(wossz+1)/2)%MOD;
cout<<ans<<"\n";
}
# | 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... |