Submission #126616

# Submission time Handle Problem Language Result Execution time Memory
126616 2019-07-08T07:42:09 Z DodgeBallMan Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "crocodile.h"

using namespace std;

const int N = 1e5 + 10;
int cnt[N];
vector<pii> g[N];
priority_queue<pii, vector<pii>, greater<pii>> q; 
int travel_plan( int n, int m, int r[][2], int l[], int k, int p[] ) 
{
    for( int i = 0 ; i < m ; i++ ) {
        g[r[i][0]].emplace_back( g[r[i][1]], l[i] );
        g[r[i][1]].emplace_back( g[r[i][0]], l[i] );
    }
    for( int i = 0 ; i < k ; i++ ) {
        cnt[p[i]]++;
        q.emplace( 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.emplace( pii( i.x, i.y + te.y ) );
        }
    }
} 

Compilation message

crocodile.cpp:8:8: error: 'pii' was not declared in this scope
 vector<pii> g[N];
        ^~~
crocodile.cpp:8:11: error: template argument 1 is invalid
 vector<pii> g[N];
           ^
crocodile.cpp:8:11: error: template argument 2 is invalid
crocodile.cpp:9:16: error: 'pii' was not declared in this scope
 priority_queue<pii, vector<pii>, greater<pii>> q; 
                ^~~
crocodile.cpp:9:28: error: 'pii' was not declared in this scope
 priority_queue<pii, vector<pii>, greater<pii>> q; 
                            ^~~
crocodile.cpp:9:31: error: template argument 1 is invalid
 priority_queue<pii, vector<pii>, greater<pii>> q; 
                               ^
crocodile.cpp:9:31: error: template argument 2 is invalid
crocodile.cpp:9:42: error: 'pii' was not declared in this scope
 priority_queue<pii, vector<pii>, greater<pii>> q; 
                                          ^~~
crocodile.cpp:9:42: error: template argument 1 is invalid
crocodile.cpp:9:45: error: template argument 1 is invalid
 priority_queue<pii, vector<pii>, greater<pii>> q; 
                                             ^~
crocodile.cpp:9:45: error: template argument 2 is invalid
crocodile.cpp:9:45: error: template argument 3 is invalid
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:13:20: error: request for member 'emplace_back' in 'g[(*(r + ((sizetype)(((long unsigned int)i) * 8))))[0]]', which is of non-class type 'int'
         g[r[i][0]].emplace_back( g[r[i][1]], l[i] );
                    ^~~~~~~~~~~~
crocodile.cpp:14:20: error: request for member 'emplace_back' in 'g[(*(r + ((sizetype)(((long unsigned int)i) * 8))))[1]]', which is of non-class type 'int'
         g[r[i][1]].emplace_back( g[r[i][0]], l[i] );
                    ^~~~~~~~~~~~
crocodile.cpp:18:11: error: request for member 'emplace' in 'q', which is of non-class type 'int'
         q.emplace( pii( p[i], 0 ) );
           ^~~~~~~
crocodile.cpp:18:20: error: 'pii' was not declared in this scope
         q.emplace( pii( p[i], 0 ) );
                    ^~~
crocodile.cpp:20:15: error: request for member 'empty' in 'q', which is of non-class type 'int'
     while( !q.empty() ) {
               ^~~~~
crocodile.cpp:21:9: error: 'pii' was not declared in this scope
         pii te = q.top(); q.pop();
         ^~~
crocodile.cpp:21:29: error: request for member 'pop' in 'q', which is of non-class type 'int'
         pii te = q.top(); q.pop();
                             ^~~
crocodile.cpp:22:13: error: 'te' was not declared in this scope
         cnt[te.x]++;
             ^~
crocodile.cpp:22:13: note: suggested alternative: 'tm'
         cnt[te.x]++;
             ^~
             tm
crocodile.cpp:25:18: error: expected ';' before 'i'
         for( pii i : g[te.x] ) if( cnt[i.x] < 2 ) {
                  ^
crocodile.cpp:28:5: error: expected primary-expression before '}' token
     }
     ^
crocodile.cpp:28:5: error: expected ';' before '}' token
crocodile.cpp:28:5: error: expected primary-expression before '}' token
crocodile.cpp:28:5: error: expected ')' before '}' token
crocodile.cpp:28:5: error: expected primary-expression before '}' token