# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445047 | osmanallazov | Fancy Fence (CEOI20_fancyfence) | C++14 | 1 ms | 204 KiB |
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>
#define ll long long
using namespace std;
int main(){
// SUBTASK 4---->SOLUTION
ll n,z,s;
ll res=0;
ll mod=1e9+7;
cin>>n;
ll h[n+1];
ll w[n+1];
for(int i=1;i<=n;i++){
cin>>h[i];
}
for(int i=1;i<=n;i++){
cin>>w[i];
}
h[0]=0;
for(int i=n;i>=1;i--)
{
s=(s+w[i])%mod ;
ll o =((h[i]*(h[i]+1))/2)%mod ;
o= ((o - ((h[i-1]*(h[i-1]+1))/2)%mod) + mod)%mod ;
ll p=((s*(s+1))/2)%mod ;
res=(res+((o*p)%mod))%mod ;
}
cout<<res;
}
Compilation message (stderr)
# | 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... |