# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82416 | 2018-10-30T13:44:02 Z | farukkastamonuda | Ferries (NOI13_ferries) | C++14 | 332 ms | 33792 KB |
#include <bits/stdc++.h> #define fi first #define se second #define lo long long #define inf 1000000009 #define md 1000000007 #define li 100005 #define mp make_pair #define pb push_back #define mid (start+end)/2 using namespace std; int n, m, x, y, z, d[li]; vector<int> v[li], t[li]; void bfs(){ for(int i = 1; i < n; i ++) d[i] = inf; priority_queue< pair<int, int> > q; q.push(mp(0, n)); while(! q.empty()){ pair<int, int> temp = q.top(); q.pop(); int cst = - temp.fi; int seh = temp.se; if(d[seh] != cst) continue; if(seh == 1){ printf("%d\n", cst); exit(0); } for(int i = 0;i < (int)v[seh].size(); i ++){ int ata = v[seh][i]; if((int)t[ata].size() > 0){ int knr = t[ata].back(); t[ata].pop_back(); if(d[ata] > d[seh] + knr){ d[ata] = d[seh] + knr; q.push(mp(- d[ata], ata)); } } } } } int main(){ scanf("%d %d", &n, &m); for(int i = 1;i <= m;i ++){ scanf("%d %d %d", &x, &y, &z); v[y].pb(x); t[x].pb(z); } for(int i = 1;i <= n; i ++){ sort(t[i].begin(), t[i].end()); } bfs(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4984 KB | Output is correct |
2 | Correct | 6 ms | 5248 KB | Output is correct |
3 | Correct | 19 ms | 6388 KB | Output is correct |
4 | Correct | 140 ms | 17060 KB | Output is correct |
5 | Correct | 139 ms | 17968 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 17968 KB | Output is correct |
2 | Correct | 6 ms | 17968 KB | Output is correct |
3 | Correct | 17 ms | 17968 KB | Output is correct |
4 | Correct | 66 ms | 17968 KB | Output is correct |
5 | Correct | 85 ms | 17968 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 17968 KB | Output is correct |
2 | Correct | 24 ms | 17968 KB | Output is correct |
3 | Correct | 267 ms | 17968 KB | Output is correct |
4 | Correct | 332 ms | 17968 KB | Output is correct |
5 | Correct | 289 ms | 21012 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 318 ms | 21012 KB | Output is correct |
2 | Correct | 322 ms | 25844 KB | Output is correct |
3 | Correct | 247 ms | 30880 KB | Output is correct |
4 | Runtime error | 284 ms | 33792 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
5 | Halted | 0 ms | 0 KB | - |