# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1013572 | daffuwu | Fancy Fence (CEOI20_fancyfence) | C++14 | 1097 ms | 2140 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 fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long n, h[100069], w[100069], smw, ans, mn, sm, pv, cur;
const long long dv = 1e9+7;
vector<pair<long long, long long> > vc;
long long calc(long long a, long long b)
{
if (a%2 == 0) a/=2;
else b/=2;
return a%dv*(b%dv)%dv;
}
int main()
{
long long i, j, up, dw;
scanf("%lld", &n);
for (i=1; i<=n; i++)
{
scanf("%lld", h+i);
}
for (i=1; i<=n; i++)
{
scanf("%lld", w+i);
}
for (i=1; i<=n; i++)
{
ans += calc(w[i], w[i]+1)*calc(h[i], h[i]+1)%dv;
ans %= dv;
mn = h[i];
for (j=i+1; j<=n; j++)
{
mn = min(mn, h[j]);
ans += w[i]*w[j]%dv*calc(mn, mn+1)%dv;
ans %= dv;
}
}
printf("%lld\n", ans);
}
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... |