# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445004 | fuad27 | 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>
using namespace std;
#define mod 1000000007
typedef long long ll;
#define int long long
ll rec(ll a, ll b)
{
ll x = 1;
if(a%2 == 0) {
x*=(a/2)%mod;
x*=a+1;
x%=mod;
}
else {
x*=((a+1)/2)%mod;
x*=a%mod;
x%=mod;
}
if(b%2 == 0) {
x*=(b/2)%mod;
x*=b+1;
x%=mod;
}
else {
x*=((b+1)/2)%mod;
x*=b%mod;
x%=mod;
}
return x%mod;
}
int32_t main () {
ll n, m;
cin >> n;
ll sumW = 0;
for(ll i = 0;i<n;i++) {
ll h;
cin >> h;
m = h;
m%=mod;
}
for(ll i = 0;i<n;i++) {
ll w;
cin >> w;
sumW += w%mod;
sumW%=mod;
}
cout<<rec(sumW, m)<<endl;
}
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... |