Submission #415129

#TimeUsernameProblemLanguageResultExecution timeMemory
415129schseMeetings (IOI18_meetings)C++17
4 / 100
5572 ms2184 KiB
#include <bits/stdc++.h> using namespace std; #ifndef EVAL #include "grader.cpp" #endif #include "meetings.h" long long calcscore(int l, int r, int p, std::vector<int> const &H) { int mx = 0; long long sum = 0; for (int i = p; i <= r; i++) { mx = max(mx, H[i]); sum += mx; } mx = 0; for (int i = p; i >= l; i--) { mx = max(mx, H[i]); sum += mx; } sum -= H[p]; return sum; } long long findmin(int l, int r, std::vector<int> const &H) { long long mx = INT64_MAX; for (int i = l; i <= r; i++) { mx = min(mx, calcscore(l, r, i, H)); } return mx; } 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); for (int j = 0; j < Q; ++j) { C[j] = findmin(L[j], R[j], H); } 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...