이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
long long h[200005];
long long w[200005];
long long md=1e9+7;
struct block{
long long h,w;
block(long long hh=0,long long ww=0){
h=hh;
w=ww;
}
};
long long calc(block x){
long long ans=x.h*(x.h+1)/2;
ans%=md;
long long ans1=x.w*(x.w+1)/2;
ans1%=md;
long long ans2=(ans*ans1)%md;
return ans2;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>h[i];
}
long long aw=0;
for(int i=1;i<=n;i++){
cin>>w[i];
aw+=w[i];
}
cout<<calc(block(h[1],aw));
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |