이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fo(i, n) for(ll i = 0; i<(n); i++)
#define pb push_back
#define F first
#define S second
#define deb(x) cout << #x << " = " << (x) << endl
#define deb2(x, y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
typedef vector<ll> vl;
typedef vector<vl> vvl;
vector<long long> minimum_costs(vector<int> H, vector<int> L, vector<int> R) {
int q = L.size();
ll n = H.size();
vl C;
fo(ind, q){
ll best = 1e18;
for(ll meet = L[ind]; meet<=R[ind]; ind++){
ll hi = H[meet];
ll current = -hi;
for(ll i = meet; i>=L[ind]; ind--){
hi = max(hi, (ll)H[i]);
current+=hi;
}
hi = H[meet];
for(ll i = meet; i<=R[ind]; ind++){
hi = max(hi, (ll)H[i]);
current+=hi;
}
best=max(best, current);
}
C.pb(best);
}
return C;
}
// int main(){
// vector<int> st = {1, 2, 1, 2, 1, 2};
// create_circuit(2, st);
// return 0;
// }
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:19:8: warning: unused variable 'n' [-Wunused-variable]
19 | ll n = H.size();
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |