# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773050 | 2023-07-04T14:23:22 Z | AmirElarbi | Cyberland (APIO23_cyberland) | C++17 | 44 ms | 19464 KB |
#include <bits/stdc++.h> #define ve vector #define vi vector<int> #define vii vector<ii> #define ii pair<int,int> #define fi first #define se second #define ll long long #define INF 1e9+7 #define pb push_back #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int MOD = 1e9+7; const int nax = 2e5+5; const int MAXL = 20+5; void readio(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } #include "cyberland.h" vii adj[nax]; double solve(int n, int m, int k, int h, vi x, vi y, vi c, vi arr) { for (int i = 0; i < m; ++i) { adj[x[i]].pb({y[i], c[i]}); adj[y[i]].pb({x[i], c[i]}); } ve<ll> dist(n, INF); priority_queue<pair<ll,int>, ve<pair<ll,int>>, greater<pair<ll,int>>> pq; for (int i = 0; i < n; ++i) { if(arr[i] == 2 || !i){ dist[i] = 0; pq.push({0, i}); } } while(!pq.empty()){ int u = pq.top().se, cst = pq.top().fi; pq.pop(); if(dist[u] != cst) continue; for(auto x : adj[u]){ if(dist[u]+x.se < dist[x.fi]){ dist[x.fi] = dist[u]+x.se; pq.push({x.fi, dist[x.fi]}); } } } cout << dist[h] << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 8 ms | 9984 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 10036 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 9856 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 44 ms | 19464 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 9944 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 10016 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 9908 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 9940 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |