#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
int w[100005];
int h[100005];
int ans = 0;
int width = 0;
int height;
int mod = 1000000007;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
// w(w+1)h(h+1)/4
cin >> n;
for(int i = 0; i < n; i++)cin >> h[i];
for(int i = 0; i < n; i++){
cin >> w[i];
width += w[i];
width %= mod;
}
// if(width % 2 == 0){ // all rectangle for h=1
// ans += (width+1)*(width/2);
// ans %= mod;
// } else {
// ans += (width*(width-1)/2)+width;
// ans %= mod;
// }
// height = h[0];
// if(height % 2 == 0){ // all rectangle for h=1
// ans *= (height+1)*(height/2);
// ans %= mod;
// } else {
// ans *= (height*(height-1)/2)+height;
// ans %= mod;
// }
int temp = (width*(width+1)/2)%mod;
int ht = h[0]%mod;
int temp2 = ht*(ht+1)/2%mod;
ans = (temp*temp2)%mod;
cout << ans;
// cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
352 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 |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
728 KB |
Output is correct |
3 |
Correct |
8 ms |
2140 KB |
Output is correct |
4 |
Correct |
18 ms |
3900 KB |
Output is correct |
5 |
Correct |
18 ms |
3932 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 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 |
1 ms |
352 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |