이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
vector<int> h, l, r;
vector<ll> respf;
ll query(int ini, int fim) {
if(fim<ini) swap(ini, fim);
ll resp=1e18;
for(int i=ini; i<=fim; i++) {
ll val=h[i]; ll maior=h[i];
for(int j=i-1; j>=ini; j--) maior=max(maior, (ll)h[j]), val+=maior;
maior=-1;
for(int j=i+1; j<=fim; j++) maior=max(maior, (ll)h[j]), val+=maior;
maior=-1;
//printf("testa %d >> %lld\n", i, val);
resp=min(resp, val);
}
return resp;
}
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
std::vector<int> R) {
h=H; l=L; r=R;
for(int i=0; i<L.size(); i++) {
int ini=L[i]; int fim=R[i];
ll val=query(ini, fim);
respf.push_back(val);
}
return respf;
}
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:28:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<L.size(); i++) {
~^~~~~~~~~
# | 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... |