# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82415 | 2018-10-30T13:42:18 Z | farukkastamonuda | Ferries (NOI13_ferries) | C++14 | 338 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 | 8 ms | 4984 KB | Output is correct |
2 | Correct | 9 ms | 5112 KB | Output is correct |
3 | Correct | 17 ms | 6452 KB | Output is correct |
4 | Correct | 153 ms | 17176 KB | Output is correct |
5 | Correct | 154 ms | 20168 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 20168 KB | Output is correct |
2 | Correct | 6 ms | 20168 KB | Output is correct |
3 | Correct | 16 ms | 20168 KB | Output is correct |
4 | Correct | 64 ms | 20168 KB | Output is correct |
5 | Correct | 95 ms | 22288 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 22288 KB | Output is correct |
2 | Correct | 24 ms | 22288 KB | Output is correct |
3 | Correct | 317 ms | 28288 KB | Output is correct |
4 | Runtime error | 338 ms | 33532 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 | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 280 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. |
2 | Halted | 0 ms | 0 KB | - |