답안 #445048

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
445048 2021-07-16T10:07:59 Z osmanallazov Fancy Fence (CEOI20_fancyfence) C++14
30 / 100
89 ms 2212 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    // SUBTASK 4---->SOLUTION
    ll n,z,s=0;
    ll res=0;
    ll mod=1e9+7;
    cin>>n;
    ll h[n+1];
    ll w[n+1];
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    for(int i=1;i<=n;i++){
        cin>>w[i];
    }
    h[0]=0;
    for(int i=n;i>=1;i--)
    {
        s=(s+w[i])%mod ;
        ll o =((h[i]*(h[i]+1))/2)%mod ;
        o= ((o - ((h[i-1]*(h[i-1]+1))/2)%mod) + mod)%mod ;
        ll p=((s*(s+1))/2)%mod ;
        res=(res+((o*p)%mod))%mod ;
    }
    cout<<res;
}

Compilation message

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:6:10: warning: unused variable 'z' [-Wunused-variable]
    6 |     ll n,z,s=0;
      |          ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 9 ms 332 KB Output is correct
3 Correct 43 ms 972 KB Output is correct
4 Correct 85 ms 1740 KB Output is correct
5 Correct 89 ms 1832 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 9 ms 636 KB Output is correct
4 Correct 43 ms 1428 KB Output is correct
5 Correct 87 ms 2212 KB Output is correct
6 Correct 88 ms 2212 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 9 ms 588 KB Output is correct
9 Correct 47 ms 1356 KB Output is correct
10 Correct 83 ms 2124 KB Output is correct
11 Correct 85 ms 2124 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct