Submission #1184589

#TimeUsernameProblemLanguageResultExecution timeMemory
1184589inesfiJakarta Skyscrapers (APIO15_skyscraper)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define int long long const int TAILLEMAXI=30*1000+2,PMAXI=172; int dejavu[TAILLEMAXI][TAILLEMAXI]; ///endroit,P vector<int> depart[TAILLEMAXI]; int nbvilles,nbjumpers; priority_queue<tuple<int,int,int>> encours; ///////// -nbcoups, pos, P signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>nbvilles>>nbjumpers; int posfinal; for (int i=0;i<nbjumpers;i++){ int a,b; cin>>a>>b; depart[a].push_back(b); if (i==0){ encours.push_back(make_tuple(0,a,0)); } else if (i==1){ posfinal=a; } } while (encours.size()!=0){ int nbcoups=get<0>(encours.top()),pos=get<1>(encours.top()),P=get<2>(encours.top()); encours.pop(); if (pos>=0 and pos<nbvilles and dejavu[pos][P]==0){ dejavu[pos][P]=1; if (pos==posfinal){ cout<<-nbcoups<<endl; return 0; } if (P!=0){ encours.push(make_tuple(nbcoups,pos,0)); encours.push(make_tuple(nbcoups-1,pos-P,P)); encours.push(make_tuple(nbcoups-1,pos+P,P)); } else { for (int i:depart[pos]){ if (i<PMAXI){ encours.push(make_tuple(nbcoups,pos,P)); } else { int a=1; while (pos-a*P>=0){ encours.push(make_tuple(nbcoups-a,pos-a*P,0)); a++; } a=1; while (pos+a*P<nbvilles){ encours.push(make_tuple(nbcoups-a,pos+a*P,0)); a++; } } } } } } cout<<-1<<endl; return 0; }

Compilation message (stderr)

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:24:21: error: 'class std::priority_queue<std::tuple<long long int, long long int, long long int> >' has no member named 'push_back'
   24 |             encours.push_back(make_tuple(0,a,0));
      |                     ^~~~~~~~~