# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
379458 | autumn_eel | 모임들 (IOI18_meetings) | C++14 | 5545 ms | 7740 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<int(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll suml[800000],sumr[800000];
P st[800000];
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
std::vector<int> R) {
int N=H.size(),Q=L.size();
vector<ll>res;
rep(i,Q){
st[0]=P(INF,L[i]-1);
ll sum=0;
int p=1;
for(int j=L[i];j<=R[i];j++){
while(st[p-1].first<H[j]){
sum-=(st[p-1].second-st[p-2].second)*st[p-1].first;
p--;
}
sum+=(j-st[p-1].second)*H[j];
suml[j]=sum;
st[p++]=P(H[j],j);
}
st[0]=P(INF,R[i]+1);
sum=0;
p=1;
for(int j=R[i];j>=L[i];j--){
while(st[p-1].first<H[j]){
sum-=(st[p-2].second-st[p-1].second)*st[p-1].first;
p--;
}
sum+=(st[p-1].second-j)*H[j];
sumr[j]=sum;
st[p++]=P(H[j],j);
}
ll ans=INF;
for(int j=L[i];j<=R[i];j++){
ans=min(ans,suml[j]+sumr[j]-H[j]);
}
res.push_back(ans);
}
return res;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |