Language: C++

//Coded by tzc_wk
/*
Êý¾Ý²»Çå¿Õ£¬±¬ÁãÁ½ÐÐÀá¡£
¶à²â²»¶ÁÍê£¬±¬ÁãÁ½ÐÐÀá¡£
±ß½ç²»ÌØÅÐ£¬±¬ÁãÁ½ÐÐÀá¡£
Ì°ÐÄ²»Ö¤Ã÷£¬±¬ÁãÁ½ÐÐÀá¡£
D P Ë³Ðò´í£¬±¬ÁãÁ½ÐÐÀá¡£
´óÐ¡ÉÙµÈºÅ£¬±¬ÁãÁ½ÐÐÀá¡£
±äÁ¿²»Í³Ò»£¬±¬ÁãÁ½ÐÐÀá¡£
Ô½½ç²»ÅÐ¶Ï£¬±¬ÁãÁ½ÐÐÀá¡£
µ÷ÊÔ²»×¢ÊÍ£¬±¬ÁãÁ½ÐÐÀá¡£
Òç³ö²» l l£¬±¬ÁãÁ½ÐÐÀá¡£
ÍüÎÄ¼þ²Ù×÷£¬±¬ÁãÁ½ÐÐÀá¡£
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
#define int long long
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
int n=read(),m=read(),s=read(),c[55],d[55];
struct edge{
	int u,v,a,b;
	edge(){/*ycxakioi*/}
	edge(int _u,int _v,int _a,int _b){
		u=_u;v=_v;a=_a;b=_b;
	}
};
const int MAGIC=2450;
inline int Q(int x){
	return min(x,MAGIC+1);
}
vector<edge> g[55];
int dp[55][2500];
struct data{
	int x,y,z;
	friend bool operator <(data a,data b){
		return a.z>b.z;
	}
};
priority_queue<data> q;
signed main(){
	fz(i,1,m){
		int u,v,a,b;cin>>u>>v>>a>>b;
		g[u].push_back(edge(u,v,a,b));
		g[v].push_back(edge(v,u,a,b));
	}
	fz(i,1,n)	c[i]=read(),d[i]=read();
	fillbig(dp);
	dp[1][Q(s)]=0;
	q.push({1,Q(s),0});
	while(!q.empty()){
		data p=q.top();q.pop();
		int x=p.x,y=p.y,z=p.z;
//		cout<<x<<" "<<y<<" "<<z<<endl;
		if(dp[x][y]<z)	continue;
		for(int i=y+c[x];;i+=c[x]){
			if(z+(i-y)/c[x]*d[x]<dp[x][Q(i)]){
//				cout<<"i="<<i<<" "<<x<<" "<<y<<" "<<z<<endl;
				dp[x][Q(i)]=z+(i-y)/c[x]*d[x];
				q.push({x,Q(i),dp[x][Q(i)]});
			}
			if(i>MAGIC)	break;
		}
		foreach(it,g[x]){
			int v=it->v,a=it->a,b=it->b;
			if(y-a>=0){
				if(dp[v][y-a]>dp[x][y]+b){
					dp[v][y-a]=dp[x][y]+b;
					q.push({v,y-a,dp[v][y-a]});
				}
			}
		}
	}
	fz(i,2,n){
		int mn=0x3f3f3f3f;
		fz(j,0,MAGIC)	mn=min(mn,dp[i][j]);
		cout<<mn<<endl;
	}
	return 0;
}

Compiler output:
a.cc:93:20: error: template argument 1 is invalid
   93 | priority_queue<data> q;
      |                    ^
a.cc:93:20: error: template argument 2 is invalid
a.cc:93:20: error: template argument 3 is invalid
a.cc: In function 'int main()':
a.cc:103:11: error: request for member 'push' in 'q', which is of non-class type 'int'
  103 |         q.push({1,Q(s),0});
      |           ^~~~
a.cc:104:18: error: request for member 'empty' in 'q', which is of non-class type 'int'
  104 |         while(!q.empty()){
      |                  ^~~~~
a.cc:105:17: error: reference to 'data' is ambiguous
  105 |                 data p=q.top();q.pop();
      |                 ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:15:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:87:8: note:                 'struct data'
   87 | struct data{
      |        ^~~~
a.cc:105:34: error: request for member 'pop' in 'q', which is of non-class type 'int'
  105 |                 data p=q.top();q.pop();
      |                                  ^~~
a.cc:106:23: error: 'p' was not declared in this scope
  106 |                 int x=p.x,y=p.y,z=p.z;
      |                       ^
a.cc:108:26: error: 'y' was not declared in this scope
  108 |                 if(dp[x][y]<z)  continue;
      |                          ^
a.cc:108:29: error: 'z' was not declared in this scope
  108 |                 if(dp[x][y]<z)  continue;
      |                             ^
a.cc:109:27: error: 'y' was not declared in this scope
  109 |                 for(int i=y+c[x];;i+=c[x]){
      |                           ^
a.cc:110:28: error: 'z' was not declared in this scope
  110 |                         if(z+(i-y)/c[x]*d[x]<dp[x][Q(i)]){
      |                            ^
a.cc:113:35: error: request for member 'push' in 'q', which is of non-class type 'int'
  113 |                                 q.push({x,Q(i),dp[x][Q(i)]});
      |                                   ^~~~
a.cc:119:28: error: 'y' was not declared in this scope
  119 |                         if(y-a>=0){
      |                            ^
a.cc:122:43: error: request for member 'push' in 'q', which is of non-class type 'int'
  122 |                                         q.push({v,y-a,dp[v][y-a]});
      |                                           ^~~~