Skip to content

Instantly share code, notes, and snippets.

@aashibhatia
aashibhatia / wormhole_samsung.cpp
Created October 8, 2019 18:56 — forked from gunpreet34/wormhole_samsung.cpp
Code for question: There is a source (S) and destination (D) and a spacecraft has to go from S to D. There are N number of wormholes in between which has following properties: Each wormhole has an entry and an exit. Each wormhole is bi-directional i.e. one can enter and exit from any of the ends. The time to cross the wormhole is given and the s…
#include<iostream>
using namespace std;
#define i_max 2147483647
int nw,sx,sy,dx,dy;//Source and destination co-ordinates
int dist[1001][1001];
bool set[1001][1001];
class Wormhole{
public:
int x1,y1,x2,y2,cost;