이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1000000007;
int f(int wossz, int hossz){
return (((((hossz*(hossz+1)/2)%mod) * wossz)%mod)*(wossz+1)/2)%mod;
}
int32_t main() {
// all hi are equal --> téglalap
int s;
cin>>s;
int h[s];
int w[s];
int wossz = 0;
bool teglalap = true;
for (int i=0; i<s; i++){
cin >> h[i];
if (h[i] != h[0]) teglalap = false;
}
int hossz = h[0];
for(int i=0; i<s; i++){
cin>>w[i];
wossz = (w[i] + wossz) % mod;
}
if (teglalap) cout << f(wossz, hossz);
//cout << (((((hossz*(hossz+1)/2)%mod) * wossz)%mod)*(wossz+1)/2)%mod<<"\n";
// --------------- lépcső -----------------
/*int ans = f(wossz, h[0]);
wossz -= w[0];
for (int i=1; i<s; i++){
ans += f(wossz, h[i]);
ans -= f(wossz, h[i-1]);
wossz -= w[i];
}
cout << ans;*/
return 0;
}
# | 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... |