#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define pii pair<int,int>
#define vl vector<ll>
#define nikah ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll maxn = 1e5+7, modn1 = 1e9+7, modn2 = 998244353;
using namespace std;
// kalo kamu ngga emas nanti nadya merasa bersalah, ayo san demi nadya!!!
// Kalo emang soalnya susah, pindah soal dulu
// Jangan sampe diem, pikirin sesuatu, pasti bisa!!!
// Cobain semua approach, jangan ngestuck di satu pemikiran
// Jangan overthinking, jangan panik, tenangin pikiranmu
ll t,n;
ll h[maxn], w[maxn];
ll f (ll x) {
return ((x * (x+1)) / 2) % modn1;
}
void solve () {
cin>>n;
for (ll i=1; i<=n; i++) {
cin>>h[i];
}
ll sum = 0;
for (ll i=1; i<=n; i++) {
cin>>w[i];
sum = (sum + w[i]) % modn1;
}
/*for (ll i=1; i<=n; i++) {
if (h[i] == 2) {
cnt+=w[i];
} else {
ans += (cnt * (cnt + 1)) % modn1;
cnt = 0;
}
}
ans += (cnt * (cnt + 1)) % modn1;*/
ll ans = (f(sum) * f(h[1])) % modn1;
cout<<ans<<endl;
}
int main () {
nikah
t = 1;
// cin>>t;
while (t--) {
solve();
// cout<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
6 ms |
1112 KB |
Output is correct |
4 |
Correct |
13 ms |
1884 KB |
Output is correct |
5 |
Correct |
11 ms |
1884 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |