Submission #874223

#TimeUsernameProblemLanguageResultExecution timeMemory
874223NoLoveToll (BOI17_toll)C++14
0 / 100
3108 ms268532 KiB
/** * author : Lăng Trọng Đạt * created: 16-11-2023 **/ #include <bits/stdc++.h> using namespace std; #ifndef LANG_DAT #define db(...) ; #endif // LANG_DAT #define int int64_t #define mp make_pair #define f first #define s second #define pb push_back #define all(v) (v).begin(), (v).end() using pii = pair<int, int>; const int MAXN = 5e4 + 5; int g[MAXN]; vector<pii> adj[MAXN]; int k, n, m, o, a, b, t; int32_t main() { cin.tie(0)->sync_with_stdio(0); if (fopen("hi.inp", "r")) { freopen("hi.inp", "r", stdin); // freopen("hi.out", "w", stdout); } cin >> k >> n >> m >> o; for (int i = 0; i < m; i++) { cin >> a >> b >> t; adj[a].pb(mp(b, t)); } while (cin >> a >> b) { priority_queue<pii, vector<pii>, greater<pii>> q; q.push({a, 0}); while (!q.empty()) { int v = q.top().f, d = q.top().s; q.pop(); db(v, d) if (v == b) { cout << d << "\n"; goto cnt; } for (pii p : adj[v]) { q.push({p.f, d + p.s}); } } cout << "-1\n"; cnt:; } }

Compilation message (stderr)

toll.cpp: In function 'int32_t main()':
toll.cpp:26:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         freopen("hi.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...