Submission #990857

# Submission time Handle Problem Language Result Execution time Memory
990857 2024-05-31T14:15:13 Z LucaIlie Fancy Fence (CEOI20_fancyfence) C++17
0 / 100
4 ms 448 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 = w[i];
        rez = ( rez + comb2(w[i] ) * comb2(h[i] ) ) % mod;
        //cout << rez << " ";
        for( j = i + 1; j < n; j++ ) {
            minn = min( minn, w[j] );
            rez = ( rez + w[i] * w[j] * comb2( minn ) ) % mod;
            //cout << rez << " ";
        }
        //cout << "\n";
    }
    cout << rez;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 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 Incorrect 4 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 448 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 1 ms 348 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -