307 | 2021-08-30 10:59:37 | Valaki2 | Fancy Fence | cpp14 | Wrong answer 30/100 | 43ms | 29568 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
void solve() {
ll n;
cin >> n;
vector<ll> height(n, 0);
vector<ll> width(n, 0);
for(ll &x : height) cin >> x;
for(ll &x : width) cin >> x;
ll cur_height = 0;
ll cur_width = 0;
ll ans = 0;
for(ll i = n - 1; i >= 0; --i) {
cur_height = height[i];
ll cur_ans = 1;
cur_ans *= (cur_width * width[i] + (width[i] * (width[i] + 1)) / 2) % mod;
cur_ans %= mod;
cur_ans *= ((cur_height * (cur_height + 1)) / 2) % mod;
cur_ans %= mod;
ans += cur_ans;
ans %= mod;
cur_width += width[i];
cur_width %= mod;
}
cout << ans << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 2ms | 1752 KiB | ||||
2 | Wrong answer | 2ms | 1816 KiB | ||||
subtask2 | 0/12 | ||||||
3 | Wrong answer | 1ms | 1868 KiB | ||||
4 | Wrong answer | 1ms | 1880 KiB | ||||
5 | Wrong answer | 1ms | 1880 KiB | ||||
6 | Wrong answer | 1ms | 1884 KiB | ||||
7 | Wrong answer | 1ms | 1888 KiB | ||||
subtask3 | 0/13 | ||||||
8 | Wrong answer | 1ms | 1912 KiB | ||||
9 | Wrong answer | 12ms | 3780 KiB | ||||
10 | Wrong answer | 24ms | 6540 KiB | ||||
11 | Wrong answer | 21ms | 7652 KiB | ||||
12 | Wrong answer | 21ms | 8768 KiB | ||||
subtask4 | 15/15 | ||||||
13 | Accepted | 1ms | 5872 KiB | ||||
14 | Accepted | 4ms | 6276 KiB | ||||
15 | Accepted | 14ms | 8312 KiB | ||||
16 | Accepted | 27ms | 11848 KiB | ||||
17 | Accepted | 28ms | 13736 KiB | ||||
subtask5 | 15/15 | ||||||
18 | Accepted | 1ms | 10884 KiB | ||||
19 | Accepted | 4ms | 11292 KiB | ||||
20 | Accepted | 14ms | 13468 KiB | ||||
21 | Accepted | 28ms | 16804 KiB | ||||
22 | Accepted | 28ms | 18752 KiB | ||||
subtask6 | 0/18 | ||||||
23 | Wrong answer | 1ms | 15844 KiB | ||||
24 | Wrong answer | 1ms | 15856 KiB | ||||
25 | Wrong answer | 2ms | 15880 KiB | ||||
26 | Wrong answer | 2ms | 15896 KiB | ||||
27 | Wrong answer | 2ms | 15920 KiB | ||||
subtask7 | 0/27 | ||||||
28 | Wrong answer | 4ms | 16320 KiB | ||||
29 | Wrong answer | 4ms | 16520 KiB | ||||
30 | Wrong answer | 14ms | 18576 KiB | ||||
31 | Wrong answer | 14ms | 19456 KiB | ||||
32 | Wrong answer | 29ms | 22880 KiB | ||||
33 | Wrong answer | 28ms | 24636 KiB | ||||
34 | Wrong answer | 28ms | 26516 KiB | ||||
35 | Wrong answer | 43ms | 28452 KiB | ||||
36 | Accepted | 1ms | 25492 KiB | ||||
37 | Wrong answer | 35ms | 29568 KiB | ||||
38 | Wrong answer | 29ms | 29528 KiB | ||||
39 | Wrong answer | 29ms | 29532 KiB | ||||
40 | Wrong answer | 28ms | 29528 KiB |