# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045173 | wood | Meetings (IOI18_meetings) | C++17 | 1 ms | 600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
std::vector<int> R) {
int Q = L.size();
std::vector<long long> C(Q);
for (int j = 0; j < Q; ++j) {
map<int,int> backwards;
long long res = LLONG_MAX;
for(int i = R[j]; i>=L[j]; i--)backwards[H[i]]++;
int mx = 0;
for(int i = L[i]; i<=R[i]; i++){
mx = max(mx,H[i]);
backwards[H[i]]--;
if(backwards[H[i]] == 0) backwards.erase(H[i]);
res = min(res,(long long)(i-L[i]+1)*mx+(R[i]-i)*backwards.rbegin()->first);
}
C[j] = res;
}
return C;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |