Submission #126624

# Submission time Handle Problem Language Result Execution time Memory
126624 2019-07-08T07:50:09 Z DodgeBallMan Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "crocodile.h"
#define pii pair<long long, long long>
#define x first
#define y second 

using namespace std;

const int N = 1e5 + 10;
long long cnt[N];
vector<pii> g[N];
priority_queue< pii, vector<pii>, greater<pii> > q; 

long long travel_plan( long long n, long long m, long long r[][2], long long l[], long long k, long long p[] ) 
{
    for( long long i = 0 ; i < m ; i++ ) {
        g[r[i][0]].emplace_back( r[i][1], l[i] );
        g[r[i][1]].emplace_back( r[i][0], l[i] );
    }
    for( long long i = 0 ; i < k ; i++ ) {
        cnt[p[i]]++;
        q.push( pii( p[i], 0 ) );
    }
    while( !q.empty() ) {
        pii te = q.top(); q.pop();
        cnt[te.x]++;
        if( cnt[te.x] != 2 ) continue ;
        if( te.x == 0 ) return te.y;
        for( pii i : g[te.x] ) if( cnt[i.x] < 2 ) {
            q.push( pii( i.x, i.y + te.y ) );
        }
    }
} 
// int main() {
//     long long n, m, r[10][2], l[23], k, p[18];
//     travel_plan( n, m, r, l, k, p );
// }

Compilation message

crocodile.cpp: In function 'long long int travel_plan(long long int, long long int, long long int (*)[2], long long int*, long long int, long long int*)':
crocodile.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
 } 
 ^
/tmp/cc4c40hg.o: In function `main':
grader.cpp:(.text.startup+0x2d): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status