답안 #1104135

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1104135 2024-10-23T02:10:20 Z ezzzay Fancy Fence (CEOI20_fancyfence) C++14
30 / 100
59 ms 8780 KB
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define int long long
const int N=3e5+5;
int h[N];
int w[N];
int ps[N];
int mod=1e9+7;
int modd(int n){
    return (n%mod+mod)%mod;
}
int calc(int a, int b){
    int f=modd(modd(a*(a+1))*500000004);
    int s=modd(modd(b*(b+1))*500000004);
    return (f*s)%mod;
}
signed main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    for(int i=1;i<=n;i++){
        cin>>w[i];
    }
    int ans=0;
    ps[n+1]=0;
    for(int i=n;i>=1;i--){
        ps[i]=modd(ps[i+1]+w[i]);
       // cout<<ps[i]<<" "<<h[i]<<" ";
      //  cout<<calc(h[i],ps[i])<<" "<<calc(h[i-1],ps[i])<<endl;
        ans+=calc(h[i],ps[i])-calc(h[i-1],ps[i]);
        //cout<<ans<<endl;
        ans=modd(ans);
    }
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Incorrect 2 ms 4432 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Incorrect 2 ms 4432 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4432 KB Output is correct
2 Correct 7 ms 4660 KB Output is correct
3 Correct 39 ms 7496 KB Output is correct
4 Correct 55 ms 8520 KB Output is correct
5 Correct 55 ms 8776 KB Output is correct
6 Correct 1 ms 4432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Correct 6 ms 4660 KB Output is correct
4 Correct 28 ms 7504 KB Output is correct
5 Correct 53 ms 8616 KB Output is correct
6 Correct 59 ms 8780 KB Output is correct
7 Correct 2 ms 4432 KB Output is correct
8 Correct 8 ms 4688 KB Output is correct
9 Correct 31 ms 7724 KB Output is correct
10 Correct 53 ms 8520 KB Output is correct
11 Correct 57 ms 8492 KB Output is correct
12 Correct 1 ms 4432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Incorrect 1 ms 4432 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Incorrect 2 ms 4432 KB Output isn't correct
3 Halted 0 ms 0 KB -