Submission #871404

# Submission time Handle Problem Language Result Execution time Memory
871404 2023-11-10T17:39:44 Z Trisanu_Das Fancy Fence (CEOI20_fancyfence) C++17
12 / 100
162 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int N, L;
ll h[100005], w[100005];
vector<ll> nh;
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> h[i];
    for(int i=0;i<N;i++){
        cin >> w[i];
        for(int j=0;j<w[i];j++){
            L++;
            nh.push_back(h[i]);
        }
    }
    ll ans=0;
    for(int i=0;i<L;i++){
        for(int j=0; j<=i; j++){
            ll m=INT_MAX;
            for(int k=j;k<=i;k++) m = min(m, nh[k]);
            (ans += (m*(m+1))/2LL) %= 100000007;
        }
    }
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 162 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 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 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Runtime error 106 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 109 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Runtime error 114 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 109 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 162 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -