Submission #388597

#TimeUsernameProblemLanguageResultExecution timeMemory
388597mariowongCrocodile's Underground City (IOI11_crocodile)C++14
100 / 100
945 ms100460 KiB
#include "crocodile.h"
#include <bits/stdc++.h>

using namespace std;

struct edge{
	int node;
	long long w;
}nw,now;

int ans;
vector <edge> e[100005];
priority_queue <pair<long long,int>  > q;
bool vis[100005][5];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
	for (int i=0;i<M;i++){
		now.w=L[i];
		now.node=R[i][0];	e[R[i][1]].push_back(now);
		now.node=R[i][1];	e[R[i][0]].push_back(now);
	}
	for (int i=0;i<K;i++){
		q.push(make_pair(0,P[i]));
		q.push(make_pair(0,P[i]));
	}
	while (!q.empty()){
		now.w=-q.top().first; now.node=q.top().second;
		if (!vis[now.node][0])
		vis[now.node][0]=true;
		else
		if (!vis[now.node][1]){
			vis[now.node][1]=true;
			if (now.node == 0) ans=now.w;
			for (int i=0;i<e[now.node].size();i++){
				if (!vis[e[now.node][i].node][1])
				q.push(make_pair(-(now.w+e[now.node][i].w),e[now.node][i].node));
			}
		}
		q.pop();
	}
	return ans;
}

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<edge>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |    for (int i=0;i<e[now.node].size();i++){
      |                 ~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...