제출 #292431

#제출 시각아이디문제언어결과실행 시간메모리
292431zoooma13모임들 (IOI18_meetings)C++14
0 / 100
21 ms2560 KiB
#include <bits/stdc++.h> #include "meetings.h" using namespace std; vector<long long> minimum_costs(vector<int> H, vector<int> L, vector<int> R){ assert(H.size() <= 5000); vector <long long> dpL(H.size()) ,dpR(H.size()) ,ans(L.size() ,LLONG_MAX); for(int q = 0; q < L.size(); q++){ int l = L[q] ,r = R[q]; long long cur = 0; vector <int> mq{l-1}; for(int i=l; i<=r; i++){ while(mq.size()>1 && H[mq.back()] <= H[i]){ cur -= (mq.back()-mq[(int)mq.size()-2])*H[mq.back()]; mq.pop_back(); } mq.push_back(i); cur += (mq.back()-mq[(int)mq.size()-2])*H[mq.back()]; dpL[i] = cur; } mq = {r+1} ,cur = 0; for(int i=r; i>=l; i--){ while(mq.size()>1 && H[mq.back()] <= H[i]){ cur -= (mq[(int)mq.size()-2]-mq.back())*H[mq.back()]; mq.pop_back(); } mq.push_back(i); cur += (mq[(int)mq.size()-2]-mq.back())*H[mq.back()]; dpR[i] = cur; } for(int i=l; i<=r; i++) ans[q] = min(ans[q] ,dpL[i]+dpR[i]-H[i]); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:8:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int q = 0; q < L.size(); q++){
      |                    ~~^~~~~~~~~~
#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...