Submission #713872

#TimeUsernameProblemLanguageResultExecution timeMemory
713872LittleOrangeMeetings (IOI18_meetings)C++17
4 / 100
5598 ms1488 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; using ll = long long; 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); int N = H.size(); for (ll qi = 0; qi < Q; qi++){ ll l = L[qi],r=R[qi]; function<ll(ll)> query = [&](ll x){ ll ans = 0; int cur = 0; for(ll i = x;i<=R[qi];i++){ cur = max(cur,H[i]); ans += cur; } cur = H[x]; for(ll i = x-1;i>=L[qi];i--){ cur = max(cur,H[i]); ans += cur; } return ans; }; C[qi] = 1e18; for(ll x = l;x<=r;x++) C[qi] = min(C[qi],query(x)); } return C; }

Compilation message (stderr)

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:8:9: warning: unused variable 'N' [-Wunused-variable]
    8 |     int N = H.size();
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...