제출 #412123

#제출 시각아이디문제언어결과실행 시간메모리
412123Mlxa모임들 (IOI18_meetings)C++14
4 / 100
5548 ms1484 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) { auto check = [&](int mn) { 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 ans; }; ll mn = check(l[it]); for (int i = l[it]; i <= r[it]; ++i) { ll t = check(i); mn = min(mn, t); } c[it] = mn; } 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...