Submission #473515

#TimeUsernameProblemLanguageResultExecution timeMemory
473515FgdxxPotatoes and fertilizers (LMIO19_bulves)C++17
Compilation error
0 ms0 KiB
#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 (stderr)

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);
      |          ^~~~~~~~~