Problem p03305 (C++)

Buggy submission (status: Time Limit Exceeded):
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vin = vector<int>;
using vll = vector<long long>;
using vvin = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vstr = vector<string>;
using vvstr = vector<vector<string>>;
using vch = vector<char>;
using vvch = vector<vector<char>>;
using vbo = vector<bool>;
using vvbo = vector<vector<bool>>;
using vpii = vector<pair<int, int>>;
using pqsin = priority_queue<int, vector<int>, greater<int>>;
#define mp make_pair
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define decp(n) cout << fixed << setprecision((int)n)
const int inf = 1e9 + 7;
const ll INF = 1000000000000000;

vector<vector<pair<ll, ll>>> yen(100010);
vector<vector<pair<ll, ll>>> snuuk(100010);
vll dyen(100010, INF);
vll dsnuuk(100010, INF);

void dijkstrayen(ll s) {
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> q;
  dyen[s] = 0;
  q.push(mp(0, s));
  while (!q.empty()) {
    auto p = q.top();
    q.pop();
    ll v = p.second;
    if (dyen[v] < p.first)
      continue;
    for (auto e : yen[v]) {
      if (dyen[e.first] > dyen[v] + e.second) {
        dyen[e.first] = dyen[v] + e.second;
        q.push(mp(dyen[e.first], e.first));
      }
    }
  }
}
void dijkstrasnuuk(ll t) {
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> q;
  dsnuuk[t] = 0;
  q.push(mp(0, t));
  while (!q.empty()) {
    auto p = q.top();
    q.pop();
    ll v = p.second;
    if (dsnuuk[v] < p.first)
      continue;
    for (auto e : snuuk[v]) {
      if (dsnuuk[e.first] > dsnuuk[v] + e.second) {
        dsnuuk[e.first] = dsnuuk[v] + e.second;
        q.push(mp(dsnuuk[e.first], e.first));
      }
    }
  }
}

int main() {
  ll n, m, s, t;
  cin >> n >> m >> s >> t;
  rep(i, m) {
    ll u, v, a, b;
    cin >> u >> v >> a >> b;
    yen[u].push_back(mp(v, a));
    yen[v].push_back(mp(u, a));
    snuuk[u].push_back(mp(v, b));
    snuuk[v].push_back(mp(u, b));
  }
  dijkstrayen(s);
  dijkstrasnuuk(t);
  vll d(n + 1);
  d[0] = INF + 1;
  rep2(i, 1, n + 1) d[i] = dyen[i] + dsnuuk[i];
  vll sum(n);
  ll mi = d[n];
  for (ll i = n - 1; i >= 0; i--) {
    sum[i] = INF - mi;
    mi = min(mi, d[i]);
  }
  rep(i, n) cout << sum[i] << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vin = vector<int>;
using vll = vector<long long>;
using vvin = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vstr = vector<string>;
using vvstr = vector<vector<string>>;
using vch = vector<char>;
using vvch = vector<vector<char>>;
using vbo = vector<bool>;
using vvbo = vector<vector<bool>>;
using vpii = vector<pair<int, int>>;
using pqsin = priority_queue<int, vector<int>, greater<int>>;
#define mp make_pair
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define decp(n) cout << fixed << setprecision((int)n)
const int inf = 1e9 + 7;
const ll INF = 1000000000000000;

vector<vector<pair<ll, ll>>> yen(100010);
vector<vector<pair<ll, ll>>> snuuk(100010);
vll dyen(100010, INF);
vll dsnuuk(100010, INF);

void dijkstrayen(ll s) {
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> q;
  dyen[s] = 0;
  q.push(mp(0, s));
  while (!q.empty()) {
    auto p = q.top();
    q.pop();
    ll v = p.second;
    if (dyen[v] < p.first)
      continue;
    for (auto e : yen[v]) {
      if (dyen[e.first] > dyen[v] + e.second) {
        dyen[e.first] = dyen[v] + e.second;
        q.push(mp(dyen[e.first], e.first));
      }
    }
  }
}
void dijkstrasnuuk(ll t) {
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> q;
  dsnuuk[t] = 0;
  q.push(mp(0, t));
  while (!q.empty()) {
    auto p = q.top();
    q.pop();
    ll v = p.second;
    if (dsnuuk[v] < p.first)
      continue;
    for (auto e : snuuk[v]) {
      if (dsnuuk[e.first] > dsnuuk[v] + e.second) {
        dsnuuk[e.first] = dsnuuk[v] + e.second;
        q.push(mp(dsnuuk[e.first], e.first));
      }
    }
  }
}

int main() {
  ll n, m, s, t;
  cin >> n >> m >> s >> t;
  rep(i, m) {
    ll u, v, a, b;
    cin >> u >> v >> a >> b;
    yen[u].push_back(mp(v, a));
    yen[v].push_back(mp(u, a));
    snuuk[u].push_back(mp(v, b));
    snuuk[v].push_back(mp(u, b));
  }
  dijkstrayen(s);
  dijkstrasnuuk(t);
  vll d(n + 1);
  d[0] = INF + 1;
  rep2(i, 1, n + 1) d[i] = dyen[i] + dsnuuk[i];
  vll sum(n);
  ll mi = d[n];
  for (ll i = n - 1; i >= 0; i--) {
    sum[i] = INF - mi;
    mi = min(mi, d[i]);
  }
  rep(i, n) cout << sum[i] << endl;
}