#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--) #define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--) #define DEBUG(C) cerr << #C << " = " << C << endl; using LL = long long; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; using VD = vector; using VVD = vector; using PII = pair; using PDD = pair; using PLL = pair; using VPII = vector; template using VT = vector; #define ALL(a) begin((a)), end((a)) #define RALL(a) rbegin((a)), rend((a)) #define SORT(a) sort(ALL((a))) #define RSORT(a) sort(RALL((a))) #define REVERSE(a) reverse(ALL((a))) #define MP make_pair #define FORE(a, b) for (auto &&a : (b)) #define FIND(s, e) ((s).find(e) != (s).end()) #define EB emplace_back const int INF = 1e9; const int MOD = INF + 9; const LL LLINF = 1e18; int N, M; VT g, grev; VI v, vrev; template, typename ctype2 = less> int search(VT &graph, VI &score, int st) { ctype comp; VT used(N, false); priority_queue pq; pq.push(MP(0, st)); score[st] = 0; while (!pq.empty()) { int nowscore, nowpoint; tie(nowscore, nowpoint) = pq.top(); pq.pop(); if (used[nowpoint]) continue; used[nowpoint] = true; FORE(e, graph[nowpoint]) { int nextscore = nowscore + e.second; if (max(score[e.first], nextscore, comp) == score[e.first]) { continue; } score[e.first] = nextscore; pq.push(MP(nextscore, e.first)); } } //FORE(e, score) cout << e << " ";cout << endl; return score[N - 1]; } int main(void) { scanf("%d%d", &N, &M); g.resize(N); v.resize(N, 0); grev.resize(N); vrev.resize(N, INF); REP(i, M) { int a, b, c; scanf("%d%d%d", &a, &b, &c); g[a].EB(MP(b, c)); grev[b].EB(MP(a, -c)); } int n = search, less>(g, v, 0); search, greater>(g, vrev, 0); int cnt = 0; REP(i, N) { cnt += v[i] != vrev[i]; } cout << n << " " << cnt << "/" << N << endl; return 0; }