Submission #286146

#TimeUsernameProblemLanguageResultExecution timeMemory
286146mohammadMeetings (IOI18_meetings)C++14
4 / 100
5590 ms1792 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]; for(int x = l ; x <= r ; ++x){ ll mx = H[x] , calc = H[x] ; for(int k = x - 1 ; k >= l; k--){ mx = max(mx , (ll)H[k]); calc += mx ; } mx = H[x]; for(int k = x + 1 ; k <= r; k++){ mx = max(mx , (ll)H[k]); calc += mx ; } ans = min(ans , calc); } C[j] = ans; } return C; }
#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...