We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Synchronous Shopping
Synchronous Shopping
Sort by
recency
|
102 Discussions
|
Please Login in order to post a comment
include
include
include
include
include
include
using namespace std;
const int MAXN = 1005; const int MAXK = 11; const int MAX_MASK = (1 << MAXK);
int n, m, k; vector> adj[MAXN]; int fish_types[MAXN]; int dist[MAXN][MAX_MASK];
void dijkstra() { // Priority queue stores {distance, {node, fish_mask}} priority_queue>, vector>>, greater>>> pq;
}
int main() { cin >> n >> m >> k;
}
include
include
include
include
include
include
using namespace std;
const int MAXN = 1005; const int MAXK = 11; const int MAX_MASK = (1 << MAXK);
int n, m, k; vector> adj[MAXN]; int fish_types[MAXN]; int dist[MAXN][MAX_MASK];
void dijkstra() { // Priority queue stores {distance, {node, fish_mask}} priority_queue>, vector>>, greater>>> pq;
}
int main() { cin >> n >> m >> k;
}
Solution in Python
WTF this question is way too hard for a 40 score medium question. had to run dynamic programming on subsets of fishes, with a run of dijkstra at each subset, to get the answer
O(2^k * (k*V + (V+E)*log(V)))