Submission #945590

# Submission time Handle Problem Language Result Execution time Memory
945590 2024-03-14T05:21:45 Z thelegendary08 Fancy Fence (CEOI20_fancyfence) C++14
0 / 100
1 ms 748 KB
#include<bits/stdc++.h>
#define vi vector<int>
#define vll vector<long long int>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<long long int, long long int>>
#define pb push_back
#define f0r(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef long long int ll;
const ll mod = 1e9 + 7;
ll ans(ll w, ll h){
    return w * (w+1)/2 % mod * h * (h+1)/2 % mod;
}

ll c2(ll x){
    return x * (x+1) / 2 % mod;
}
int main(){
    int n;
    cin>>n;
    vll w(n);
    vll h(n);
    f0r(i,n)cin>>h[i];
    f0r(i,n)cin>>w[i];
    ll dp[n+1];
    dp[0] = ans(w[0], h[0]);
    for(int i = 1;i<n;i++){
        dp[i] = ((dp[i-1] + ans(w[i], h[i])) % mod + (w[i-1] * w[i] % mod * c2(min(h[i-1], h[i])) % mod)) % mod;
    }
    cout<<dp[n-1];
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 748 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 424 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 500 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -