Submission #412089

#TimeUsernameProblemLanguageResultExecution timeMemory
412089MlxaMeetings (IOI18_meetings)C++14
0 / 100
311 ms2196 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #define mp make_pair #define mt make_tuple #define x first #define y second #include "meetings.h" vector<ll> minimum_costs(vector<int> h, vector<int> l, vector<int> r) { int q = (int)l.size(); vector<ll> c(q); for (int it = 0; it < q; ++it) { int mn = l[it]; for (int i = l[it]; i <= r[it]; ++i) { if (h[mn] > h[i]) { mn = i; } } ll ans = -h[mn]; int cur = h[mn]; for (int i = mn; i <= r[it]; ++i) { cur = max(cur, h[i]); ans += cur; } cur = h[mn]; for (int i = mn; i >= l[it]; --i) { cur = max(cur, h[i]); ans += cur; } c[it] = ans; } return c; } #ifdef LC #include "grader.cpp" #endif
#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...