Language: C++

#include <bits/stdc++.h>

#define INF 9999999999
using namespace std;




template<typename T> class Dijkstra {
public:
	struct edge {
		int to;
		T cost;
	};
	struct P {
	public:
		T * first;    // 頂点までの距離d[i]のポインタ（for(int i=0;i<G[v].size();i++)で重複pushを防ぐ）
		int second;    // 頂点
		bool operator <(const P& other) const {
			return *first > *(other.first);
		}
		P(T* a, int b) {
			first = a;
			second = b;
		}
	};
	vector<vector<edge> > G;
	vector<T> d;
	vector<bool> used;
	int n; //頂点数
	Dijkstra(int num) {
		n = num;
		G(num);
		d(num, INF);
		used(num, false);
	}
	void add_edge(int u, int v, T cost) {
		G[u].push_back((edge) { v, cost });
		G[v].push_back((edge) { u, cost });
	}
	void solve(int s) {
		priority_queue<P, vector<P> > q;
		d[s] = 0;
		q.push(P(d + s, s));
		while (!q.empty()) {
			P p = q.top();
			q.pop();
			int v = p.second;
			used[v] = true;
			for (int i = 0; i < G[v].size(); i++) {
				edge e = G[v][i];
				if (used[e.to] == true) {
					continue;
				}
				T vcost = d[v] + e.cost;
				if (d[e.to] == INF) {
					d[e.to] = vcost;
					q.push(P(d + e.to, e.to));
				}
				else if (d[e.to] > vcost) {
					d[e.to] = vcost;
				}
			}
		}
	}
};



int main() {
	int from, to, cost, n, m, s, t;
	cin >> n >> m >> s >> t;
	s--;
	t--;
	Dijkstra<long long> p(n), q(n);
	for (int i = 0; i < m; i++) {
		long long u, v, a, b;
		cin >> u >> v >> a >> b;
		p.add_edge(u, v, a);
		q.add_edge(u, v, b);
	}
	p.solve(s);
	q.solve(t);
	vector<long long> d(n);
	for (int i = 0; i < n; i++) {
		d[i] = p.d[i] + q.d[i];
	}
	for (int i = n - 2; i >= 0; i--) {
		p[i] = min(p[i], p[i + 1]);
	}
	long long ans = (ll)1000000000000000;
	for (int i = 0; i < n; i++) {
		cout << ans - p[i] << endl;
	}


	return 0;
}

Compiler output:
a.cc: In constructor 'Dijkstra<T>::Dijkstra(int)':
a.cc:35:21: error: no match for call to '(std::vector<bool>) (int&, bool)'
   35 |                 used(num, false);
      |                 ~~~~^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:89:18: error: no match for 'operator[]' (operand types are 'Dijkstra<long long int>' and 'int')
   89 |                 p[i] = min(p[i], p[i + 1]);
      |                  ^
a.cc:89:29: error: no match for 'operator[]' (operand types are 'Dijkstra<long long int>' and 'int')
   89 |                 p[i] = min(p[i], p[i + 1]);
      |                             ^
a.cc:89:35: error: no match for 'operator[]' (operand types are 'Dijkstra<long long int>' and 'int')
   89 |                 p[i] = min(p[i], p[i + 1]);
      |                                   ^
a.cc:91:26: error: 'll' was not declared in this scope
   91 |         long long ans = (ll)1000000000000000;
      |                          ^~
a.cc:93:32: error: no match for 'operator[]' (operand types are 'Dijkstra<long long int>' and 'int')
   93 |                 cout << ans - p[i] << endl;
      |                                ^
a.cc: In instantiation of 'Dijkstra<T>::Dijkstra(int) [with T = long long int]':
a.cc:75:25:   required from here
   75 |         Dijkstra<long long> p(n), q(n);
      |                                ^
a.cc:33:18: error: no match for call to '(std::vector<std::vector<Dijkstra<long long int>::edge, std::allocator<Dijkstra<long long int>::edge> >, std::allocator<std::vector<Dijkstra<long long int>::edge, std::allocator<Dijkstra<long long int>::edge> > > >) (int&)'
   33 |                 G(num);
      |                 ~^~~~~
a.cc:34:18: error: no match for call to '(std::vector<long long int, std::allocator<long long int> >) (int&, long int)'
   34 |                 d(num, INF);
      |                 ~^~~~~~~~~~
a.cc: In instantiation of 'void Dijkstra<T>::solve(int) [with T = long long int]':
a.cc:82:9:   required from here
   82 |         p.solve(s);
      |         ~~~~~~~^~~
a.cc:44:28: error: no match for 'operator+' (operand types are 'std::vector<long long int, std::allocator<long long int> >' and 'int')
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
  627 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
 1798 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3598 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   'std::vector<long long int, std::allocator<long long int> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3616 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   mismatched types 'const _CharT*' and 'std::vector<long long int, std::allocator<long long int> >'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3635 |     operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 3652 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   'std::vector<long long int, std::allocator<long long int> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
 3670 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   'std::vector<long long int, std::allocator<long long int> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3682 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   'std::vector<long long int, std::allocator<long long int> >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 3689 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   'std::vector<long long int, std::allocator<long long int> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 3696 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   'std::vector<long long int, std::allocator<long long int> >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   44 |                 q.push(P(d + s, s));
      |                          ~~^~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 3719 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note:   template argument deduction/substitution failed:
a.cc:44:28: note:   mismatched types 'const _CharT*' and 'std::vector<long long int, std::allocator<long long int> >'
   44 |                 q.push(P(d + s, s));
      |