## Search found 34 matches

Tue Mar 03, 2015 12:54 pm
Forum: Volume 113 (11300-11399)
Topic: 11343 - Isolated Segments
Replies: 1
Views: 1328

### Re: 11343 - Isolated Segments

I am getting RTE on this problem.I tried to implement bentley ottmann algorithm.I know this problem can be solved in O(n^2) but i wanted to check correctness of my implemented bentley ottmann.Can anyone provide me some test cases? #include <bits/stdc++.h> #define EPS 1e-9 using namespace std; struct...
Mon Feb 23, 2015 4:55 pm
Forum: Algorithms
Topic: Line Sweep Algo, Closest Pairs, and Red-Black Trees
Replies: 9
Views: 4505

### Re: Line Sweep Algo, Closest Pairs, and Red-Black Trees

What are some straight forward sweep line problems?
Fri Feb 13, 2015 3:52 pm
Forum: Volume 6 (600-699)
Topic: 634 - Polygon
Replies: 3
Views: 4450

### Re: 634 - Polygon

I am getting wrong answer for this problem.Can anyone figure out where is the problem? #include <bits/stdc++.h> #define EPS 1e-9 #define pi acos(-1) using namespace std; struct point { //***when points are double double x,y,angle; point() { x=0; y=0; angle=0; } //sort points first with respect to x ...
Thu Jan 29, 2015 11:33 am
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 21048

### Re: 191 - Intersection

Can i assume the recangle lines are parallel to axis?
Thu Dec 25, 2014 7:19 am
Forum: Volume 111 (11100-11199)
Topic: 11163 - Jaguar King
Replies: 17
Views: 10846

### Re: 11163 - Jaguar King

WA.Need some test cases. #include <bits/stdc++.h> using namespace std; int manh[45][45],grid[45],n,bound; int man() { int r1,c1,r2,c2,i,j; for(i=1;i<=41;i++) { r1=(i-1)/4; r1++; c1=i%4; if(c1==0) c1=4; for(j=1;j<=41;j++) { r2=(j-1)/4; r2++; c2=j%4; if(c2==0) c2=4; manh[i][j]=abs(r1-r2)+abs(c1-c2); }...
Fri Dec 12, 2014 10:11 am
Forum: Volume 16 (1600-1699)
Topic: 1626 - Brackets sequence
Replies: 1
Views: 1714

### Re: 1626 - Brackets sequence

I thought it was an adhoc but getting WA.Where is the problem? //#include <bits/stdc++.h> #include<cstdio> #include<sstream> #include<cstdlib> #include<cctype> #include<cmath> #include<algorithm> #include<set> #include<queue> #include<stack> #include<list> #include<iostream> #include<fstream> #inclu...
Fri Oct 03, 2014 11:43 am
Forum: Volume 12 (1200-1299)
Topic: 1218 - Perfect Service
Replies: 2
Views: 2042

### Re: 1218 - Perfect Service

WA and the only testcase given by brianfry is too big to debug. #include<cstdio> #include<sstream> #include<cstdlib> #include<cctype> #include<cmath> #include<algorithm> #include<set> #include<queue> #include<stack> #include<list> #include<iostream> #include<fstream> #include<numeric> #include<strin...
Tue Sep 30, 2014 3:44 pm
Forum: Volume 124 (12400-12499)
Topic: 12406 - Help Dexter
Replies: 6
Views: 3169

### Re: 12406 - Help Dexter

Because thats what came to my mind at first glance @brianfry713
Tue Sep 30, 2014 11:51 am
Forum: Volume 124 (12400-12499)
Topic: 12406 - Help Dexter
Replies: 6
Views: 3169

### Re: 12406 - Help Dexter

Getting TLE....is this problem solvable with bitmask?? i counted current position and previous combination of (1,2) as my dp state.Here is my code. #include<cstdio> #include<sstream> #include<cstdlib> #include<cctype> #include<cmath> #include<algorithm> #include<set> #include<queue> #include<stack> ...
Sun Sep 21, 2014 12:21 pm
Forum: Volume 102 (10200-10299)
Topic: 10278 - Fire Station
Replies: 59
Views: 22523

### Re: 10278 - Fire Station

Is there anyway to solve the problem by running dijkstra's algo only once instead of placing firestation at every possible intersection?
Mon Sep 15, 2014 10:34 am
Forum: Volume 121 (12100-12199)
Topic: 12118 - Inspector's Dilemma
Replies: 1
Views: 1057

### Re: 12118 - Inspector's Dilemma

Is it not a ad hoc? My technique was to start with a node with lowest degree and traverse the graph by dfs.If at any node i do not find any new edges to explore i will return to its paernt only if the parent still has any new node to explore.That is how i calculated minimum no of edges to travel in ...
Sat Sep 13, 2014 5:39 pm
Forum: Volume 103 (10300-10399)
Topic: 10342 - Always Late
Replies: 25
Views: 11611

### Re: 10342 - Always Late

At first i thought it is an easy problem but struggling for past two days.Is modification of dijkstras algo enough to get AC?Or do i have to know k'th shortest path algo(yen's algo) or floyd's modification?
Thu Sep 11, 2014 9:22 am
Forum: Volume 104 (10400-10499)
Topic: 10459 - The Tree Root
Replies: 30
Views: 10964

### Re: 10459 - The Tree Root

Thanks brianfry713,you always help .Struggled to find out worse roots but at last ACED.
Sat Sep 06, 2014 9:42 pm
Forum: Volume 104 (10400-10499)
Topic: 10459 - The Tree Root
Replies: 30
Views: 10964

### Re: 10459 - The Tree Root

That's why i asked whether is it possible that there is a forest instead of a tree in input.Even your output differs from the output i got herehttp://www.udebug.com/UVa/10459... I do not think there is any input where any node is isolated.
Sat Sep 06, 2014 1:42 pm
Forum: Volume 104 (10400-10499)
Topic: 10459 - The Tree Root
Replies: 30
Views: 10964

### Re: 10459 - The Tree Root

Is the given tree connected or could there be any forest???Getting Wa... Passed all I/O of the forum when the tree is connected,here is my code

Code: Select all

``````//ACED
``````