#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, h[1000001], w[1000001], ans, mod=(10e9)+7;
signed main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
cin>>n;
for (int i=0; i<n; i++){
cin>>h[i];
}
for (int i=0; i<n; i++){
cin>>w[i];
}
for (int i=1; i<=h[0]; i++){
ans+=i;
}
if (w[0]!=1){
ans+=h[0]*3*(w[0]-1)-1;
ans%=mod;
}
for (int i=1; i<n; i++){
ans+=3*w[i]*h[i]-1;
ans%=mod;
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Incorrect |
76 ms |
2496 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
76 ms |
2500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Incorrect |
76 ms |
2496 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |