Language: C++

/*
Á·Ï°Ìâ£ºRoad Construction_AOJ 2249 
	Ë«cost²ÎÊý¸ÄÁ¼Dijkstra¡£ 
*/ 

#include <bits/stdc++.h>
using namespace std;

const int MAX_V=10007;

struct edge {
	int to, dis, cost;
	edge(){}
	edge(int to, int dis, int cost):to(to), dis(dis), cost(cost){}
	bool operator > (const edge &b) const
	{
		return dis!=b.dis? dis>b.dis : cost>b.cost;
	}//ÏÈ±È½Ï¾àÀë£¬ÔÙ±È½Ï»¨·Ñ 
}P;

int V, E;
vector<edge> G[MAX_V]; //ÏÂ±ê³äµ±from
int mark[MAX_V];

void dijkstra()
{
	int res=0;
	//°´ÕÕedge¶¨ÒåµÄË³ÐòÅÅÁÐ£¬ÏÈÈ¡³ö×îÊ¡µÄÂ· 
	priority_queue<P, vector<P>, greater<P> > que;
	fill(mark, mark+V, false);
	que.push(P(0,0,0));
	
	while(que.size()) //¸´ÔÓ¶ÈÎªO(|E|Xlog|V|) 
	{
		P p = que.top();
		que.pop();
		int v=p.to;
		if(mark[v])
			continue;
		mark[v]=true;
		res+=p.cost;
		for(int i=0; i<G[v].size(); i++)
		{
			edge e=G[v][i];
			que.push(P(e.to, p.dis+e.dis, e.cost));
		}
	}
	
	return res;
}

int main()
{
	while(scanf("%d%d", &V, &E)!=EOF)
	{
		if(V==0&&E==0)
			break;
		
		for(int i=0; i<=V; i++)
			G[i].clear();
		
		for(int i=0; i<M; i++)
		{
			int f, t, d, c;
			scanf("%d%d%d%d", &f, &t, &d, &c);
			f--;
			t--;
			G[f].push_back(P(t,d,c));
			G[t].push_back(P(f,d,c));
		}
		
		printf("%d\n", dijkstra());
		
		
		
		
	}
	
	
	return 0;
}






Compiler output:
a.cc: In function 'void dijkstra()':
a.cc:29:35: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   29 |         priority_queue<P, vector<P>, greater<P> > que;
      |                                   ^
a.cc:29:35: note:   expected a type, got 'P'
a.cc:29:35: error: template argument 2 is invalid
a.cc:29:47: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp> struct std::greater'
   29 |         priority_queue<P, vector<P>, greater<P> > que;
      |                                               ^
a.cc:29:47: note:   expected a type, got 'P'
a.cc:29:49: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Sequence, class _Compare> class std::priority_queue'
   29 |         priority_queue<P, vector<P>, greater<P> > que;
      |                                                 ^
a.cc:29:49: note:   expected a type, got 'P'
a.cc:29:49: error: template argument 2 is invalid
a.cc:29:49: error: template argument 3 is invalid
a.cc:31:13: error: request for member 'push' in 'que', which is of non-class type 'int'
   31 |         que.push(P(0,0,0));
      |             ^~~~
a.cc:31:19: error: no match for call to '(edge) (int, int, int)'
   31 |         que.push(P(0,0,0));
      |                  ~^~~~~~~
a.cc:33:19: error: request for member 'size' in 'que', which is of non-class type 'int'
   33 |         while(que.size()) //¸´ÔÓ¶ÈÎªO(|E|Xlog|V|)
      |                   ^~~~
a.cc:35:18: error: expected ';' before 'p'
   35 |                 P p = que.top();
      |                  ^~
      |                  ;
a.cc:36:21: error: request for member 'pop' in 'que', which is of non-class type 'int'
   36 |                 que.pop();
      |                     ^~~
a.cc:37:23: error: 'p' was not declared in this scope
   37 |                 int v=p.to;
      |                       ^
a.cc:45:29: error: request for member 'push' in 'que', which is of non-class type 'int'
   45 |                         que.push(P(e.to, p.dis+e.dis, e.cost));
      |                             ^~~~
a.cc:49:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   49 |         return res;
      |                ^~~
a.cc: In function 'int main()':
a.cc:62:32: error: 'M' was not declared in this scope
   62 |                 for(int i=0; i<M; i++)
      |                                ^
a.cc:68:41: error: no match for call to '(edge) (int&, int&, int&)'
   68 |                         G[f].push_back(P(t,d,c));
      |                                        ~^~~~~~~
a.cc:69:41: error: no match for call to '(edge) (int&, int&, int&)'
   69 |                         G[t].push_back(P(f,d,c));
      |                                        ~^~~~~~~
a.cc:72:40: error: invalid use of void expression
   72 |                 printf("%d\n", dijkstra());
      |                                ~~~~~~~~^~