Submission #286322

#TimeUsernameProblemLanguageResultExecution timeMemory
286322mohammadMeetings (IOI18_meetings)C++14
Compilation error
0 ms0 KiB
#include "meetings.h" #include<bits/stdc++.h> using namespace std; #define endl "\n" // #define int long long typedef long long ll ; const ll ooo = 1e18 ; const ll oo = 2e9 ; const double PI = acos(-1) ; const ll M = 1e9 + 7 ; const int N = 10000010 ; vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) { int Q = L.size(); vector<ll> C(Q); for (int j = 0; j < Q; ++j) { ll ans = ooo; int l = L[j] , r = R[j]; stack<pair<ll,ll>> q; ll cost = 0; vector<ll> cl(r - l + 1) , cr(r - l + 1); for(int i = l ; i <= r ;++i){ ll w = 1 ; while(q.size() && q.top().first <= H[i]){ cost += (ll)(H[i] - q.top().first) * q.top().second; w += q.top().second; q.pop(); } q.push({cost , w}); cl[i] = cost; cost += H[i]; } q = stack<pair<ll,ll>>(); for(int i = r ; i >= l ;--i){ ll w = 1 ; while(q.size() && q.top().first <= H[i]){ cost += (ll)(H[i] - q.top().first) * q.top().second; w += q.top().second; q.pop(); } q.push({cost , w}); cr[i] = cost; cost += H[i]; } for(int i = l ; i <= r ; ++i) ans = min(ans , cl[i] + cr[i] + h[i]); C[j] = ans; } 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:47:65: error: 'h' was not declared in this scope
   47 |   for(int i = l ; i <= r ; ++i) ans = min(ans , cl[i] + cr[i] + h[i]);
      |                                                                 ^