제출 #580355

#제출 시각아이디문제언어결과실행 시간메모리
580355alirezasamimi100선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> #define pb push_back #define F first #define S second using namespace std; using ll = long long int; using pll = pair<ll, ll>; ll delivery(int N, int K, int L, int p[]) { ll dp[N + 2], pd[N + 2], ans = 1e18; vector<ll> vec = {-1}; priority_queue<pll, vector<pll>, greater<pll>> st; for(int i = 0; i < N; i++) if(p[i]) vec.pb(p[i]); dp[0] = pd[vec.size()] = 0; st.push({0, 0}); for(int i = 1; i < (int)vec.size(); i++){ while(st.top().S < i - K) st.pop(); dp[i] = st.top().F + vec[i] + min(vec[i], L - vec[i]); st.push({dp[i], i}); } st.clear(); st.push({0, vec.size()}); for(int i = (int)vec.size() - 1; i; i--){ while(st.top().S > i + K) st.pop(); pd[i] = st.top().F + L - vec[i] + min(vec[i], L - vec[i]); st.push({pd[i], i}); } for(ll i = 0; i < (int)vec.size(); i++) ans = min(ans, dp[i] + pd[i + 1]); return ans; }

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

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:24:8: error: 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >' has no member named 'clear'
   24 |     st.clear();
      |        ^~~~~