Submission #445046

# Submission time Handle Problem Language Result Execution time Memory
445046 2021-07-16T10:05:17 Z osmanallazov Fancy Fence (CEOI20_fancyfence) C++14
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    // SUBTASK 4---->SOLUTION
    ll n,z,s;
    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];
    }
    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;
      |          ^
fancyfence.cpp:20:13: warning: 's' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |         s=(s+w[i])%mod ;
      |           ~~^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -