Submission #944169

# Submission time Handle Problem Language Result Execution time Memory
944169 2024-03-12T09:27:50 Z beepbeepsheep Meetings (IOI18_meetings) C++17
0 / 100
10 ms 2396 KB
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e18;
ll arr[105][105];
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
                                     std::vector<int> R) {
    ll n=H.size();
    ll q=L.size();
    vector<ll> ans;
    for (int i=0;i<n;i++){
        arr[i][i]=H[i];
        for (int j=i-1;j>=0;j--){
            arr[i][j]=max<ll>(arr[i][j+1],H[j]);
        }
        for (int j=i+1;j<n;j++){
            arr[i][j]=max<ll>(arr[i][j-1],H[j]);
        }
        for (int j=1;j<n;j++){
            arr[i][j]+=arr[i][j-1];
        }
    }
    for (int i=0;i<q;i++){
        ll tot=inf;
        for (int j=L[i];j<=R[i];j++){
            if (L[i]!=0) tot=min(tot,arr[j][R[i]]-arr[j][L[i]-1]);
            else tot=min(tot,arr[j][R[i]]);
        }
        ans.emplace_back(tot);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 2 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 2 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 10 ms 2396 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 10 ms 2396 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 2 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -