#include "meetings.h"
#include "bits/stdc++.h"
using namespace std;
vector<long long> minimum_costs(vector<int> H, vector<int> L, vector<int> R){
vector<long long> h, l, r;
long long n = H.size();
long long q = L.size();
for(long long i = 0; i < n; i++) h.push_back((long long)H[i]);
for(long long i = 0; i < q; i++) l.push_back((long long)L[i]);
for(long long i = 0; i < q; i++) r.push_back((long long)R[i]);
vector<long long> c(q);
for(long long i = 0; i < q; i++){
long long Bien = LLONG_MAX;
for(long long j = l[i]; j <= r[i]; j++){
long long Costo = h[j];
long long Mayor = h[j];
for(long long k = j - 1; k >= l[i]; k--){
Mayor = max(Mayor, h[k]);
Costo += Mayor;
}
Mayor = h[j];
for(long long k = j + 1; k <= r[i]; k++){
Mayor = max(Mayor, h[k]);
Costo += Mayor;
}
if(Costo < Bien) Bien = Costo;
}
c[i] = Bien;
}
return c;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
10 ms |
448 KB |
Output is correct |
3 |
Correct |
59 ms |
600 KB |
Output is correct |
4 |
Correct |
19 ms |
348 KB |
Output is correct |
5 |
Correct |
59 ms |
348 KB |
Output is correct |
6 |
Correct |
7 ms |
548 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
3 ms |
348 KB |
Output is correct |
9 |
Correct |
64 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
10 ms |
448 KB |
Output is correct |
3 |
Correct |
59 ms |
600 KB |
Output is correct |
4 |
Correct |
19 ms |
348 KB |
Output is correct |
5 |
Correct |
59 ms |
348 KB |
Output is correct |
6 |
Correct |
7 ms |
548 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
3 ms |
348 KB |
Output is correct |
9 |
Correct |
64 ms |
348 KB |
Output is correct |
10 |
Execution timed out |
5559 ms |
608 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Execution timed out |
5564 ms |
3288 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Execution timed out |
5564 ms |
3288 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
10 ms |
448 KB |
Output is correct |
3 |
Correct |
59 ms |
600 KB |
Output is correct |
4 |
Correct |
19 ms |
348 KB |
Output is correct |
5 |
Correct |
59 ms |
348 KB |
Output is correct |
6 |
Correct |
7 ms |
548 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
3 ms |
348 KB |
Output is correct |
9 |
Correct |
64 ms |
348 KB |
Output is correct |
10 |
Execution timed out |
5559 ms |
608 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |