#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
// SUBTASK 4---->SOLUTION
ll n,z,s;
ll mod=1e9+7;
cin>>n;
ll h[n];
ll w[n];
for(ll i=0;i<n;i++){
cin>>h[i];
}
ll he=h[0];
ll we=0;
for(ll i=0;i<n;i++){
cin>>w[i];
we=(we+w[i])%mod;
}
if(he%2==0){
ll p=he/2;
z=p*(he+1)%mod;
}
else{
ll p=(he+1)/2;
z=(p*he)%mod;
}
if(we%2==0){
ll p=we/2;
s=p*(we+1)%mod;
}
else{
ll p=(we+1)/2;
s=(p*we)%mod;
}
ll res=z*s%mod;
cout<<res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
9 ms |
568 KB |
Output is correct |
3 |
Correct |
44 ms |
1180 KB |
Output is correct |
4 |
Correct |
90 ms |
1868 KB |
Output is correct |
5 |
Correct |
91 ms |
1956 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |