Submission #628805

# Submission time Handle Problem Language Result Execution time Memory
628805 2022-08-13T17:23:12 Z a_aguilo Fancy Fence (CEOI20_fancyfence) C++14
15 / 100
82 ms 2132 KB
#include<bits/stdc++.h>

using namespace std;

int MOD = 1e9+7;

int main(){
    int n;
    cin >> n;
    vector<long long int> heights(n);
    vector<long long int> widths(n);
    for(int i = 1; i <= n; ++i) cin >> heights[n-i];
    for(int i = 1; i <= n; ++i) cin >> widths[n-i];
    long long int ans = 0;
    long long int W = 0;
    long long int H;
    for(int i = 0; i < n; ++i){
        W += widths[i];

        W%=MOD;
        long long chooseW = (W*(W+1)/2)%MOD;
        if(i == n-1) H = heights[i];
        else H = heights[i]- heights[i+1];
        long long chooseh = (H*(H+1)/2)%MOD;
        ans+= (chooseW*chooseh)%MOD;
        if(i != n-1){
            ans += (H*chooseW)%MOD;
        }
        ans%=MOD;
    }
    cout << ans << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 8 ms 456 KB Output is correct
3 Correct 39 ms 1300 KB Output is correct
4 Correct 78 ms 2132 KB Output is correct
5 Correct 82 ms 2048 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 8 ms 340 KB Output is correct
4 Correct 40 ms 1336 KB Output is correct
5 Correct 76 ms 2104 KB Output is correct
6 Correct 79 ms 2008 KB Output is correct
7 Incorrect 1 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 308 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -