# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38104 | 2018-01-01T07:04:59 Z | nibnalin | 페리들 (NOI13_ferries) | C++14 | 159 ms | 32768 KB |
#include <iostream> #include <cstdio> #include <vector> #include <set> using namespace std; const int maxn = int(3e5)+5, inf = int(2e9)+5; int D[maxn]; multiset<int> into[maxn]; vector<int> graph[maxn]; int main(void) { int n, m, a, b, c; scanf("%d%d", &n, &m); for(int i = 0;i < n;i++) D[i] = inf; for(int i = 0;i < m;i++) { scanf("%d%d%d", &a, &b, &c); a--, b--; graph[b].push_back(a); into[a].insert(c); } set<pair<int, int>> Q; D[n-1] = 0; Q.insert({D[n-1], n-1}); while(!Q.empty()) { pair<int, int> top = *Q.begin(); Q.erase(Q.begin()); //cout << top.first << " " << top.second << "\n"; for(auto it: graph[top.second]) { int w = *into[it].rbegin(); into[it].erase(into[it].find(w)); if(D[it] > D[top.second]+w) { D[it] = D[top.second]+w; if(D[it] != inf) Q.erase({D[it], it}); Q.insert({D[it], it}); } } } printf("%d\n", D[0]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 24284 KB | Output is correct |
2 | Correct | 9 ms | 24416 KB | Output is correct |
3 | Correct | 29 ms | 25612 KB | Output is correct |
4 | Memory limit exceeded | 109 ms | 32768 KB | Memory limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 24284 KB | Output is correct |
2 | Correct | 6 ms | 24416 KB | Output is correct |
3 | Correct | 26 ms | 25476 KB | Output is correct |
4 | Correct | 159 ms | 30748 KB | Output is correct |
5 | Memory limit exceeded | 86 ms | 32768 KB | Memory limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 26000 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Memory limit exceeded | 159 ms | 32768 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |