connected path in a matrix

The problem statement is :
A group of people is going for a fun trip to a city coordinated at (1,1). During their visit, a network started spreading all over the world. After knowing about the network, they decided to safely return to their home town coordinated at (n,m). Among all the paths from (1,1) to (n,m), some got in the contact with this network. They want to avoid networked paths and hence started calculating the total number of safe paths. Since it can take them a lot of time to find all the safe paths, so they have asked you to help.

You have been given a map in the form of a matrix of size n*m. Each coordinate represents a city on the map. You are required to find the total number of safe paths starting from the city (1,1) and ending at the city (n,m). You are allowed to move either right or down in a single move, that is, if you are at the city (x,y), then you can go to either(x+1,y) or (x,y+1) in a single move. You are not allowed to move outside the map.

A path is networked if the product of all the numbers in the path is divisible by X.

Input format

Note: Since the input matrix can be very large, therefore you are given only K coordinate’s values and remaining coordinates have values W.

The first line contains four space-separated integers n,m,k,w . The next k lines contain three space-separated integers x,y,v denoting the coordinate (x,y) has value v.

Output format

Print a single integer denoting the total number of safe paths modulo 10^9 +7.

my approach toward code:

  #include <iostream>   #include <string>  #include <limits>   #include <algorithm>   using namespace std;   // M x N matrix  #define M 5  #define N 5   // Naive recursive function to find the minimum cost to reach  // cell (m, n) from cell (0, 0) int findMinCost(int cost[M][N], int m, int n)  {   // base case   if (n == 0 || m == 0)     return INT_MAX;  // if we're at first cell (0, 0) if (m == 1 && n == 1)     return cost[0][0];  // include cost of the current cell in path and recur to find minimum // of the path from adjacent left cell and adjacent top cell. return min (findMinCost(cost, m - 1, n), findMinCost(cost, m, n - 1))             + cost[m - 1][n - 1];  }  // main function int main() { int cost[M][N] = {     { 4, 7, 8, 6, 4 },     { 6, 7, 3, 9, 2 },     { 3, 8, 1, 2, 4 },     { 7, 1, 7, 3, 7 },     { 2, 9, 8, 9, 3 } };  cout << "The minimum cost is " << findMinCost(cost, M, N);  return 0; } 

I am getting trouble on how to product the coordinate”s value after every move with having to give a proper matrix of size n*m. Somone please help me .

Host not connected to my router shows up in a nmap scan

After scanning my local network with nmap, this host shows up listed as a nmap result but it is the only host that shows on nmap that is not listed as a client on my router list of connected devices.

❯ nmap 192.168.0.xxx -A                                                                                                                                                                  Starting Nmap 7.80 ( https://nmap.org ) at 2020-04-21 14:33 -03 Nmap scan report for 192.168.0.xxx Host is up (0.0056s latency). Not shown: 998 closed ports PORT     STATE SERVICE VERSION 6666/tcp open  upnp    MiniUPnP 1.6 (Linksys/Belkin WiFi range extender; SDK 4.1.2.0; UPnP 1.0; MTK 2.001) |_irc-info: Unable to open connection 8888/tcp open  upnp    MiniUPnP 1.6 (Linksys/Belkin WiFi range extender; SDK 4.1.2.0; UPnP 1.0; MTK 2.001)  Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 37.47 seconds 

What exactly about this host might be causing it to show on nmap in my local network if its not connected to my router?

Efficiently finding “unfounded edges” in a strongly connected graph

I’ve encountered a problem I need to solve concerning dependency graphs. I’ve simplified it as follows:

Consider a strongly connected graph G = (V,E).

  • We define a subset of vertices S ⊆ V as source vertices.
  • We call an edge e = (a,b) unfounded if there is no simple path from any source vertex to b that includes e. In other words, all paths from a source vertex that include edge e, must include vertex b at least twice.

The problem:

  • Find all unfounded edges in G.

There are some obvious ways to solve this inefficently (e.g. a depth-first traversal for each edge in G), but I was wondering if there was any O(|E|) approach. I’ve been struggling with this for a while and I keep “almost” solving it in linear time. Perhaps that’s impossible? I have no idea what the lower bound on efficiency is, and I was hoping some readers here could help me discover some efficient approaches.

Efficiently remove nodes from a connected graph

Suppose you have a connected graph and want to remove k nodes such that the result is still connected. How could you do this efficiently?

It occurs to me that you could find any spanning tree, say by a tree search of any kind. Identify all leaves in the spanning tree, all of these can be removed without disconnecting the remaining vertices. If you have more than k leaves then you’re done, but in any tree you’re only guaranteed 2 leaves. So you may need to reiterate the process until you’ve removed k vertices.

That implies O(k) runs of a tree search. Does a more efficient algorithm exist? I don’t think you can just look for articulation points or bridge edges because removing a single vertex may suddenly make other vertices which weren’t articulation points now turn into articulation points.

Is there any way to hide my using the internet (or maximize privacy) when connected via router to other computers?

I shall begin my question with the remark that I am not tech savvy at all!

The problem is the following:

A cluster of computers (laptops, desktops, etc.) A, B, C, D… are all connected to the same router. Let’s say my computer is computer A and I am a guest at big brother Bob’s home, who owns the router and computers B, C, D…

Assuming Bob has no physical access to my computer but can access the other computers, is there a way to prevent Bob from knowing what I am doing on the internet, or even better, to completely hide from Bob that I used internet at all? (short of his contacting his ISP and demanding a report or something which would take a non-trivial amount of time and assuming I don’t download anything or watch HD videos which could show up as a sudden spike of consumption)

When it comes to hiding the names of websites I visit and internet searches, according to some research it seems like Tor does a good job in hiding it completely, even if the ISP is contacted. However, can Bob determine quickly (i.e. without contacting his ISP, using some cmd dark arts) that computer A has connected to a Tor node at all without physically accessing computer A? (Let’s say it’s not in the cluster anymore when Bob does his checks)

According to further research it seems to be impossible to get the internet history of all connected devices to a router without access to the devices, but I am unsure and opinions seem to vary somewhat.

TL;DR I’m basically looking for a way to make my internet usage as inconspicuous as possible during a very specific time period when indirectly connected to other computers via a router I don’t own, is using Tor the best thing I can do in this situation to maximize privacy?

Thank you.

Articulation points (or cut vertices), but only subset of vertices need to be connected

I know we can find all articulation points efficiently in a graph using DFS.

But what if not all nodes need to be connected, but instead we have set of node pairs that need to communicate (there is a path between them). How to efficiently find all nodes (vertices) which removal will cause some of mentioned pairs to be disconnected (can’t communicate with each other)?

For example, we can have different cases for image below (undirected graph):

  1. If pairs are A-B and C-D, then 2 is not vertex cut, because pairs remain connected.
  2. If pairs are A-C and B-D, then 2 is vertex cut, because pairs can’t communicate (there is no path between them).

If we know set of pairs that need to communicate, what is the most efficient way to find all “vertices cuts”? enter image description here

What type of activity at the WAN port of router can cause massive data uploads, when no devices are connected? [closed]

I have Airtel Broadband PPPoE connection with Public Dynamic IP assigned to my router Dlink DIR 615 (It’s old model and now discontinued). Intermittently I have noticed instances of unusually high uploads from my Internet account. For example in say 10 hours over 80 GB of data gets ‘uploaded’ and against that only a negligible say 100 MB of data gets ‘downloaded’ automatically when no device is connected to the router. I later verified this with data consumption charts available in my account.

I installed data loggers on my mobile phone and no unusual activity or data consumption found. No PC / Laptop connected to the router when it happens. Router is secure, very long complex password WPA2 and WPS disabled. Port & Address restricted firewall, PING on WAN is disabled The massive uploads happen even if I disabled WIFI which means whatever happens, must be at the WAN port.

I contacted ISP and they said is that the connection has physical port binding which means that if another LAN cable is taken out from the hub or whatever device they have at the common area in the apartment complex, no one else can get on to the internet even if they know my PPPoE user id/password. The access is bound to a particular physical port on the ISP’s device.

I am sure this is not a data logging error as whenever it happened, I could see the Internet LED rapidly glowing on the router, so it was for real.

It stops as soon as I reboot the router as it generally takes another Dynamic Public IP from the ISP.

Nothing much found in the router logs. Router does not seem to be able to differentiate between normal uploads/downloads and such instances of massive uploads.

See the screenshot for ISP chart. Yellow bar is upload and brown bar is download.

What kind of activity, if any, at the WAN port of the router can cause massive data uploads when no devices are connected to the router and even WiFi is disabled? From where this data is generated?

enter image description here

Using an active or passive scan, can I detect all devices connected to or transmitting via a Wifi network?

I know that it’s possible to do a passive scan on all channels to see if an access point sends a beacon. However, is it also possible to listen to general Wifi traffic on that channel and assemble a list of all active devices – both “clients” (like smartphone or laptop) and access points?

Can someone bug/hack your home network and take control of electronics connected to it?

Scenario

Basic home network setup, typical router/modem with WPA2 pw setup. No other protection or anything else setup.

Is it feasible/possible to hack someone’s network or setup an unauthorized network and take control of any electronic device that connects to it?

If so, could someone turn a phone or ipad into an audio device and use that to record or spy on someone?