Submission #207571

# Submission time Handle Problem Language Result Execution time Memory
207571 2020-03-08T04:39:02 Z aloo123 Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
 #include <crocodile.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
#define pii pair<int,int>
const int INF = 10000000000000000;
int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){
	vector<pii> adj[n];
	for(int i =0;i<m;i++){
		int u = r[i][0];
		int v = r[i][1];
		int d = l[i];
		adj[u].push_back(make_pair(u,d));
		adj[v].push_back(make_pair(v,d));
	}
	pii dis[n];
	for(int i =0;i<n;i++) dis[i] = mp(INF,INF);
	priority_queue<pii,vector<pii>,greater<pii>> pq;
	for(int i =0;i<k;i++){
		ll u = p[i];
		pq.push(mp(0,u));
		dis[u].f = 0;
		dis[u].s = 0;
	}

	while(!pq.empty()){
		pii u = pq.front();
		pq.pop();
		for(auto v:adj[u]){
			int vertex = v.s;
			if(dis[vertex].f > dis[u.s].f + v.f){
				dis[vertex].s = dis[vertex].f;
				dis[vertex].f = dis[u.s].f + v.f;
				pq.push(mp(dis[vertex.f,vertex]));
			}
		}
	}

	return dis[0].s;

}

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:22:3: error: 'll' was not declared in this scope
   ll u = p[i];
   ^~
crocodile.cpp:22:3: note: suggested alternative: 'l'
   ll u = p[i];
   ^~
   l
crocodile.cpp:23:16: error: 'u' was not declared in this scope
   pq.push(mp(0,u));
                ^
crocodile.cpp:29:14: error: 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >' has no member named 'front'
   pii u = pq.front();
              ^~~~~
crocodile.cpp:31:17: error: no match for 'operator[]' (operand types are 'std::vector<std::pair<long long int, long long int> > [n]' and 'std::pair<long long int, long long int>')
   for(auto v:adj[u]){
                 ^
crocodile.cpp:33:19: error: 'struct std::pair<long long int, long long int>' has no member named 'f'
    if(dis[vertex].f > dis[u.s].f + v.f){
                   ^
crocodile.cpp:33:29: error: 'struct std::pair<long long int, long long int>' has no member named 's'
    if(dis[vertex].f > dis[u.s].f + v.f){
                             ^
crocodile.cpp:34:17: error: 'struct std::pair<long long int, long long int>' has no member named 's'
     dis[vertex].s = dis[vertex].f;
                 ^
crocodile.cpp:34:33: error: 'struct std::pair<long long int, long long int>' has no member named 'f'
     dis[vertex].s = dis[vertex].f;
                                 ^
crocodile.cpp:35:17: error: 'struct std::pair<long long int, long long int>' has no member named 'f'
     dis[vertex].f = dis[u.s].f + v.f;
                 ^
crocodile.cpp:35:27: error: 'struct std::pair<long long int, long long int>' has no member named 's'
     dis[vertex].f = dis[u.s].f + v.f;
                           ^
crocodile.cpp:36:27: error: request for member 'f' in 'vertex', which is of non-class type 'long long int'
     pq.push(mp(dis[vertex.f,vertex]));
                           ^
crocodile.cpp:41:16: error: 'struct std::pair<long long int, long long int>' has no member named 's'
  return dis[0].s;
                ^