3072021-08-30 10:59:37Valaki2Fancy Fencecpp14Wrong answer 30/10043ms29568 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted2ms1752 KiB
2Wrong answer2ms1816 KiB
subtask20/12
3Wrong answer1ms1868 KiB
4Wrong answer1ms1880 KiB
5Wrong answer1ms1880 KiB
6Wrong answer1ms1884 KiB
7Wrong answer1ms1888 KiB
subtask30/13
8Wrong answer1ms1912 KiB
9Wrong answer12ms3780 KiB
10Wrong answer24ms6540 KiB
11Wrong answer21ms7652 KiB
12Wrong answer21ms8768 KiB
subtask415/15
13Accepted1ms5872 KiB
14Accepted4ms6276 KiB
15Accepted14ms8312 KiB
16Accepted27ms11848 KiB
17Accepted28ms13736 KiB
subtask515/15
18Accepted1ms10884 KiB
19Accepted4ms11292 KiB
20Accepted14ms13468 KiB
21Accepted28ms16804 KiB
22Accepted28ms18752 KiB
subtask60/18
23Wrong answer1ms15844 KiB
24Wrong answer1ms15856 KiB
25Wrong answer2ms15880 KiB
26Wrong answer2ms15896 KiB
27Wrong answer2ms15920 KiB
subtask70/27
28Wrong answer4ms16320 KiB
29Wrong answer4ms16520 KiB
30Wrong answer14ms18576 KiB
31Wrong answer14ms19456 KiB
32Wrong answer29ms22880 KiB
33Wrong answer28ms24636 KiB
34Wrong answer28ms26516 KiB
35Wrong answer43ms28452 KiB
36Accepted1ms25492 KiB
37Wrong answer35ms29568 KiB
38Wrong answer29ms29528 KiB
39Wrong answer29ms29532 KiB
40Wrong answer28ms29528 KiB