#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define int long long
#define ll long long
#define pb push_back
#define fi first
#define se second
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;
typedef pair<ld,ld> pll;
const int MAXN = 3e5+15;
const int INF = 3e18+10;
const int MX = 2e18;
const int MOD = 1e9+7;
void chmn(int &a, int b){ a = min(a, b); }
void chsum(int &a, int b){ a = (a+b)%MOD; }
void chmul(int &a, int b){ a = (a*b)%MOD; }
int mul(int a, int b){ return (a*b)%MOD; }
int sum(int a, int b){ return (a+b)%MOD; }
int expo(int a, int b){
if(b==0) return 1;
int te = expo(a, b/2); te = mul(te, te);
return (b%2 ? mul(te, a) : te);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
int h[MAXN], w[MAXN];
int two;
signed main(){
// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
two = expo(2, MOD-2);
for(int i=1; i<=n; i++) cin >> h[i];
int sum = 0;
for(int i=1; i<=n; i++){ cin >> w[i]; sum += w[i]; sum %= MOD; }
cout << mul(mul(mul(sum, sum+1), two), mul(h[1], mul(h[1]+1, two))) << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
5 ms |
2652 KB |
Output is correct |
3 |
Correct |
22 ms |
5680 KB |
Output is correct |
4 |
Correct |
40 ms |
6484 KB |
Output is correct |
5 |
Correct |
46 ms |
6740 KB |
Output is correct |
6 |
Correct |
1 ms |
2392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |