Submission #963030

# Submission time Handle Problem Language Result Execution time Memory
963030 2024-04-14T11:30:18 Z anton Fancy Fence (CEOI20_fancyfence) C++17
12 / 100
1 ms 348 KB
#include<bits/stdc++.h>

using namespace std;
#define int long long
#define pii pair<int,int>

const int MAX_N = 1e5;
int h[MAX_N];
int w[MAX_N];

int nbp(int u){
    return u*(u+1)/2;
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n; 
    cin>>n;
    for(int i = 0; i<n; i++){
        cin>>h[i];
    }
    for(int i = 0; i<n; i++){
        cin>>w[i];
    }

    int res= 0;
    
    for(int l = 0; l<n; l++){
        int minh= h[l];
        for(int r = l; r<n; r++){
            minh= min(minh, h[r]);
            if(r!=l){
                res += nbp(minh) * w[l]*w[r];
            }
            else{
                res+= nbp(minh) * nbp(w[l]);
            }
        }
    }

    cout<<res<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 344 KB Output is correct
2 Incorrect 1 ms 344 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 1 ms 348 KB Output is correct
2 Incorrect 1 ms 344 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 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 348 KB Output isn't correct
3 Halted 0 ms 0 KB -