제출 #528307

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
5283072022-02-19 21:24:07DeepessonFancy Fence (CEOI20_fancyfence)C++17
100 / 100
83 ms3864 KiB
#include <bits/stdc++.h>
using ll = long long;
const ll MOD = 1e9+7;
typedef std::pair<ll,ll> pii;
ll gaussian(ll x){
return ((x*(x+1LL))/2LL)%MOD;
}
ll get_local(pii u){
return (gaussian(u.first)*gaussian(u.second))%MOD;
}
ll get_total(pii u){
return (gaussian(u.first)*u.second)%MOD;
}
int main()
{
ll ans=0;
ll temp=0;
int N;std::cin>>N;
long long a[N],b[N];
for(auto&x:a)std::cin>>x;
for(auto&x:b)std::cin>>x;
std::deque<pii> stack;
for(int i=0;i!=N;++i){
ll alpha=a[i],beta=b[i];
pii local = {alpha,beta};
ans=(ans+get_local(local))%MOD;
ll k=0;
while(stack.size()){
auto __ = stack.back();
if(__.first>=alpha){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...