Submission #990861

# Submission time Handle Problem Language Result Execution time Memory
990861 2024-05-31T14:24:36 Z LucaIlie Fancy Fence (CEOI20_fancyfence) C++17
12 / 100
3 ms 376 KB
#include <iostream>

using namespace std;

#define nmax 10000
#define mod 1000000007
int w[nmax], h[nmax];

int comb2( int x ) {
    long long rez = 0;
    rez = rez + x + ((long long) x - 1) * x / 2;
    return rez % mod;
}

int main() {
    int i, j, n, minn;
    long long rez = 0;
    cin >> n;
    for( i = 0; i < n; i++ )
        cin >> h[i];
    for( i = 0; i < n; i++ )
        cin >> w[i];
    for( i = 0; i < n; i++ ) {
        minn = h[i];
        rez = ( rez + comb2(w[i] ) * comb2(h[i] ) ) % mod;
        //cout << rez << " ";
        for( j = i + 1; j < n; j++ ) {
            minn = min( minn, h[j] );
            rez = ( rez + w[i] * w[j] % mod * comb2( minn ) ) % mod;
            //cout << rez << " ";
        }
        //cout << "\n";
    }
    cout << rez;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 3 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 Correct 0 ms 376 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 3 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 3 ms 348 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 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -