0% found this document useful (0 votes)
35 views4 pages

Role: Student: Name: Abhinav

Uploaded by

Abhinav Vats
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views4 pages

Role: Student: Name: Abhinav

Uploaded by

Abhinav Vats
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

eLab Role: Student Name: Abhinav Id: 307589233604 Dept: Computer Science And Engineering LOGOUT

November 11th 2024, 11:39:19 Pm

CHALLENGE INFORMATION

You have already solved this challenge ! Though you can run the code with different logic !

Course DS Session Graph Question Information Level 1 Challenge 83

Problem Question description

Kaaleppi has just robbed a bank and is now heading to the harbor. However, the police wants to stop him by closing some streets of the city.

What is the minimum number of streets that should be closed so that there is no route between the bank and the harbor?

Constraints

2≤n≤500
1≤m≤1000
1≤a,b≤n

Input

The first input line has two integers n and m: the number of crossings and streets. The crossings are numbered 1,2,…,n. The bank is located at
crossing 1, and the harbor is located at crossing n.

After this, there are m lines that describe the streets. Each line has two integers and b: there is a street between crossings a and b. All streets
are two-way streets, and there is at most one street between two crossings.
Output

First print an integer k: the minimum number of streets that should be closed. After this, print k lines describing the streets. You can print any
valid solution.

Test
Logical Test Cases
Cases

Test Case 1 Test Case 2

INPUT (STDIN) INPUT (STDIN)

4 5 4 5
1 2 1 1
1 3 2 2
2 3 2 3
3 4 3 4
1 4 1 4

EXPECTED OUTPUT EXPECTED OUTPUT

2 1
1 4 1 4
3 4

Mandatory Test Cases


Test Case 1 Test Case 2

KEYWORD KEYWORD

void link(int i,int h) int bfs(int n,int s,int t)

Complexity Test Cases

Test Case 1 Test Case 2 Test Case 3

CYCLOMATIC COMPLEXITY TOKEN COUNT NLOC

1 735 93

Code
You have already solved this challenge ! Though you can run the code with different logic !
Editor

Code Editor c Custom Input (stdin) T1 T2

1 #include <stdio.h>
Type Here
2
3 #define N 500
4
5 #define M 1000
6 //abhinav Vats RA2311003030310 Output MATCH T1 MATCH T2
7
8 struct L {
9 struct L *next;
10 int h;
Empty
11 } aa[N];
12 int ij[M], cc[M * 4];
13 int dd[N];
14 void link(int i int h) {
14 void link(int i,int h) {
15 static struct L l91[M * 4], *l = l91; Complexity Analysis
16 l->h = h;
17 l->next = aa[i].next; aa[i].next = l++;
18 }
Test Case Status
19 int bfs(int n,int s,int t) {
20 static int qq[N];
21 int h, i, j, head, cnt, d;
22 for (i = 0; i < n; i++)
23 dd[i] = n;
24 dd[s] = 0;
25 head = cnt = 0;
26 qq[head + cnt++] = s;
27 while (cnt) {
28 struct L *l;
SAVE RESET RUN EVALUATE

Waiting for your Submission !


Your code will be Evaluated

For any inquiries, please contact your Faculty or Course Coordinator Student Manual DOWNLOAD

You might also like