Submission #258186

# Submission time Handle Problem Language Result Execution time Memory
258186 2020-08-05T13:55:17 Z monus1042 Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vll vector<ll>
#define pb push_back
#define mkp make_pair
#define all(X) X.begin(), X.end()

const int MAXS = 100002;
const ll inf = 1e15;
vector< pair<int, ll> > g[MAXS];
priority_queue < pair<ll, int>, vector< pair<ll, int> >, greater< pair<ll,int> > > pq;
vll d(MAXS, inf);
int state[MAXS]; // 0 unvisited, 1 has first val, 2 totally updated

void dj(){
  while(!pq.empty()){
    int auxu = pq.top().second;
    ll w = pq.top().first;
    pq.pop();
    state[auxu]++;
    if (state[auxu] == 2){
      d[auxu] = w;
      for (int i=0; i<(int)g[auxu].size(); i++){
	int v = g[auxu][i].first;
	ll wuv = g[auxu][i].second + w;
	if (state[v] < 2){
	  pq.push(mkp(v, wuv));
	}
      }
    }
  }
}

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] ].pb(mkp( R[i][1] , L[i]));
    g[ R[i][1] ].pb(mkp( R[i][0] , L[i]));
  }

  for (int i=0; i<K; i++){
    pq.push(mkp(0, P[i]));
    d[P[i]]=0;
    state[P[i]]=1;
  }

  dj();
  return (int)d[0];
}

Compilation message

crocodile.cpp:8:9: error: 'vll' does not name a type; did you mean 'll'?
 typedef vll vector<ll>
         ^~~
         ll
crocodile.cpp:15:27: error: 'MAXS' was not declared in this scope
 vector< pair<int, ll> > g[MAXS];
                           ^~~~
crocodile.cpp:17:1: error: 'vll' does not name a type; did you mean 'll'?
 vll d(MAXS, inf);
 ^~~
 ll
crocodile.cpp:18:11: error: 'MAXS' was not declared in this scope
 int state[MAXS]; // 0 unvisited, 1 has first val, 2 totally updated
           ^~~~
crocodile.cpp: In function 'void dj()':
crocodile.cpp:25:5: error: 'state' was not declared in this scope
     state[auxu]++;
     ^~~~~
crocodile.cpp:25:5: note: suggested alternative: 'stime'
     state[auxu]++;
     ^~~~~
     stime
crocodile.cpp:27:7: error: 'd' was not declared in this scope
       d[auxu] = w;
       ^
crocodile.cpp:28:28: error: 'g' was not declared in this scope
       for (int i=0; i<(int)g[auxu].size(); i++){
                            ^
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:41:5: error: 'g' was not declared in this scope
     g[ R[i][0] ].pb(mkp( R[i][1] , L[i]));
     ^
crocodile.cpp:47:5: error: 'd' was not declared in this scope
     d[P[i]]=0;
     ^
crocodile.cpp:48:5: error: 'state' was not declared in this scope
     state[P[i]]=1;
     ^~~~~
crocodile.cpp:48:5: note: suggested alternative: 'stime'
     state[P[i]]=1;
     ^~~~~
     stime
crocodile.cpp:52:15: error: 'd' was not declared in this scope
   return (int)d[0];
               ^