답안 #473515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473515 2021-09-15T15:55:22 Z Fgdxx Potatoes and fertilizers (LMIO19_bulves) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<long long>odp1(n);
    priority_queue<long long,vector<long long>,greater<long long>>odp2;
    for(auto &x : odp1)
    {
        int a,b;
        cin>>a>>b;
        x=(b-a);
        odp2.push_back(0);
    }
    partial_sum(odp1.begin(),odp1.end(),odp1.begin());
    odp2.push_back(0);
    odp2.push_back(0);
    int punkty=0;
    for(auto x : odp1 )
    {
        odp2.pop();
        punkty+=max(-x-odp2.top(),0LL);
        odp2.push(-x);
        odp2.push(-x);
    }
    long long wi=0;
    while(odp2.top()!=-odp1.back())
    {
        auto m=odp2.top();
        
        
        odp2.pop();
        punkty+=wi*(odp2.top()-m);
        wi++;
    }
    cout<<punkty;
    return 0;
}

Compilation message

bulves.cpp: In function 'int main()':
bulves.cpp:14:14: error: 'class std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' has no member named 'push_back'
   14 |         odp2.push_back(0);
      |              ^~~~~~~~~
bulves.cpp:17:10: error: 'class std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' has no member named 'push_back'
   17 |     odp2.push_back(0);
      |          ^~~~~~~~~
bulves.cpp:18:10: error: 'class std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' has no member named 'push_back'
   18 |     odp2.push_back(0);
      |          ^~~~~~~~~