Submission #240458

# Submission time Handle Problem Language Result Execution time Memory
240458 2020-06-19T16:52:49 Z oscarsierra12 Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std ;

const int N = 1e5+2 ;
#define  ff   first
#define  ss   second
#define pb    push_back

const int oo = 1e9+2 ;

vector <pair<int,int> > G[N] ;
int deg[N] ;
int fr[N], sc[N] ;
int visit[N] ;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    for ( int i = 0 ; i < N ; ++i ) fr[i] = sc[i] = oo ;
    for ( int i = 0 ; i < M ; ++i ) G[R[i][0]].pb ( make_pair(R[i][1], L[i]) ), G[R[i][1]].pb ( make_pair(R[i][0], L[i])) ;
    queue <pair<int,int> > q ;
    for ( int i = 0 ; i < K ; ++i ) fr[P[i]] = sc[P[i]] = 0, q.push ( make_pair ( 0, P[i] ) ) ;
    while ( q.size() ) {
        pair <int,int> u = q.top() ;
        q.pop() ;
        if ( visit[ u.ss ] ) continue ;
        visit[u.ss] = 1 ;
        for ( auto v:G[u.ss] ) {
            if ( -u.ff + v.ss < sc[v.ff] ) sc[v.ff] = -u.ff + v.ss ;
            if ( fr[v.ff] > sc[v.ff] ) swap ( fr[v.ff], sc[v.ff] ) ;
            deg[v.ff]++ ;
            if ( deg[v.ff] >= 2 ) q.push ( make_pair(-sc[v.ff], v.ff) ) ;
        }
    }
    return sc[0] ;
}


Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:24:30: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
         pair <int,int> u = q.top() ;
                              ^~~
                              pop