Submission #984816

# Submission time Handle Problem Language Result Execution time Memory
984816 2024-05-17T06:01:01 Z rshohruh Cyberland (APIO23_cyberland) C++17
15 / 100
64 ms 4436 KB
#include "cyberland.h"

#include <vector>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using node = pair<int, ll>;
double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) {
    for(int x: arr) assert(x == 1);
    vector<vector<node>> g(N);
    vector<ll> h(N, 1e18);
    for(int i = 0; i < M; ++i){
        g[x[i]].emplace_back(y[i], c[i]);
        g[y[i]].emplace_back(x[i], c[i]);
    }
    
    priority_queue<node, vector<node>, greater<node>> b; 
    b.emplace(0, 0);
    while(!b.empty()){
        auto [u, cur] = b.top();
        b.pop();
        if(h[u] < cur) continue;
        h[u] = cur;
        for(auto [v, w]: g[u])
            b.emplace(v, cur+w);
    }
    return (h[H] == 1e18 ? -1 : h[H]);
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1508 KB Correct.
2 Correct 28 ms 1620 KB Correct.
3 Correct 24 ms 1372 KB Correct.
4 Correct 25 ms 1472 KB Correct.
5 Correct 25 ms 1624 KB Correct.
6 Correct 24 ms 2560 KB Correct.
7 Correct 28 ms 2492 KB Correct.
8 Correct 12 ms 3164 KB Correct.
9 Correct 23 ms 1368 KB Correct.
10 Correct 22 ms 1372 KB Correct.
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 4436 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 1360 KB Correct.
2 Correct 43 ms 1612 KB Correct.
3 Correct 47 ms 1652 KB Correct.
4 Correct 64 ms 2508 KB Correct.
5 Correct 25 ms 1112 KB Correct.
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -