Search found 35 matches

by vsha041
Sun Mar 30, 2014 8:50 am
Forum: Volume 8 (800-899)
Topic: 820 - Internet Bandwidth
Replies: 43
Views: 20687

Re: 820 - Internet Bandwidth

Here is a monster test case and the answer is verfied through this website - http://uvatoolkit.com/problemssolve.php Input 50 1 50 977 37 4 310 10 42 432 38 43 27 17 20 14 13 40 319 48 11 513 20 34 365 8 26 792 27 9 118 43 5 726 3 22 863 29 50 751 8 43 853 39 5 700 50 24 664 38 46 799 44 32 363 26 1...
by vsha041
Sun Mar 30, 2014 8:35 am
Forum: Volume 8 (800-899)
Topic: 820 - Internet Bandwidth
Replies: 43
Views: 20687

Re: 820 - Internet Bandwidth

Remember that you need to print new line after every test case including the last one. For some of the problems on UVA, we don't need to print a blank line after last test case. Not printing the blank line after the last test case will result in Wrong Answer and not Presentation Error . Test cases f...
by vsha041
Sat Mar 29, 2014 10:58 am
Forum: Volume 12 (1200-1299)
Topic: 1225 - Digit Counting
Replies: 17
Views: 4366

Re: 1225 - Digit Counting

Thanks. But the strange part is that for some of the problems we don't get presentation error even if we put an extra space/spaces after the last number.
by vsha041
Wed Mar 26, 2014 10:34 pm
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 24512

Re: 160 - Factors and Factorials

Those getting runtime error, looks like input contains number greater than 100 so generate little extra primes.
by vsha041
Wed Mar 26, 2014 10:34 pm
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 24512

Re: Presentation error on 160

Thanks for the edge case Brian. And those getting runtime error - looks like input contains number greater than 100 as well.
by vsha041
Thu Mar 20, 2014 9:54 pm
Forum: Volume 110 (11000-11099)
Topic: 11080 - Place the Guards
Replies: 40
Views: 11319

Re: 11080 : algorithm

Some useful test cases Input 1 5 3 0 1 3 2 2 1 Output 3 Input 1 1 0 Output 1 Output is 3 because junction 4 needs to be guarded as well and other than that you can place guards at 0 and 2. To solve this problem just check if it is bipartite or not? But remember that graph could be disconnected so yo...
by vsha041
Sun Mar 16, 2014 1:44 pm
Forum: Volume 126 (12600-12699)
Topic: 12680 - Shopping Malls
Replies: 0
Views: 603

12680 - Shopping Malls

This is an interesting question. Following points might be helpful. 1. The key to this question is to realize that in case of walking/stairs/(escalator -the other way) the euclidean distance will be sqrt((5*(floor1 - floor2))^2 + (x1-x2)^2 + (y1-y2)^2). The points are in 3D. Also graph is directed e...
by vsha041
Wed Mar 12, 2014 8:27 pm
Forum: Volume 5 (500-599)
Topic: 530 - Binomial Showdown
Replies: 137
Views: 33288

Re: 530 woes

Some hints for this problem: Most important line is - "This number will always fit into an integer, i.e. it will be less than 2^31" Now you need to know that a row n in a pascal's triangle contains the expansion of nCr. The first term in a pascal triangle is always 1 and the second term is n so you ...
by vsha041
Sun Mar 09, 2014 3:19 am
Forum: Volume 116 (11600-11699)
Topic: 11629 - Ballot evaluation
Replies: 8
Views: 4355

Re: 11629 - Ballot evaluation

I wasted one hour just to trying to get answers right. Then I compiled my code with GCC and got a warning saying == should not be used with float. So I decided to work with integers instead but it took me one hour to realize that we can just multiply all numbers by 10 before storing them as there is...
by vsha041
Sat Mar 01, 2014 11:51 pm
Forum: Volume 101 (10100-10199)
Topic: 10139 - Factovisors
Replies: 80
Views: 26697

Re: 10139 - Factovisors

My code was passing all test cases until I found this test case: 6664 429470327 The answer here is Yes it divides because the prime factors of 429470327 are 11^1 * 13^1 * 1733^2. Now obviously 6664! contains 11 and 13 in it but my code was doing it in the following way. For 6664!, I was calculating ...
by vsha041
Wed Feb 26, 2014 9:27 am
Forum: Volume 5 (500-599)
Topic: 539 - The Settlers of Catan
Replies: 22
Views: 8064

Re: 539 why wa ..plz help

Thanks Bryan. But are you saying that graph is small? Even if graph is big - say 1 million vertices and 10^12 edges. If we run DFS from every node then the run time will still be O(V^4). But longest path problem is NP Complete. Can you please elaborate a bit? Thanks for your time.
by vsha041
Wed Feb 26, 2014 9:22 am
Forum: Volume 3 (300-399)
Topic: 383 - Shipping Routes
Replies: 27
Views: 5830

Re: 383 - Shipping Route

For those of you getting presentation errors notice that after DATA SET you need to print two spaces. See below: SHIPPING ROUTES OUTPUT DATA SET 1 (there are two spaces after the word SET) $500 $1400 $100 NO SHIPMENT POSSIBLE $2600 DATA SET 2 (there are two spaces after the word SET) NO SHIPMENT POS...
by vsha041
Tue Feb 25, 2014 1:23 pm
Forum: Volume 5 (500-599)
Topic: 539 - The Settlers of Catan
Replies: 22
Views: 8064

Re: 539 why wa ..plz help

Can someone explain as to why for this problem running DFS from every node can give us longest path in a graph? It works but I think longest path problem in a graph is NP-Complete. Then how come there is a solution in polynomial time?

Thanks.
by vsha041
Mon Feb 24, 2014 4:50 am
Forum: Volume 103 (10300-10399)
Topic: 10315 - Poker Hands
Replies: 63
Views: 27240

Re: 10315 - Poker Hands

gg004 wrote:In case

Code: Select all

7C 7C 7D 2H 5S 2D 6D 7S 7S 7D
It's sure that White wins.

Why Tie. is accpected?
Your input is invalid as there are duplicates present in your test case (7c, 7d, 7s are repeated). This kind of test case will never appear in the judge's input.
by vsha041
Mon Feb 24, 2014 4:49 am
Forum: Volume 103 (10300-10399)
Topic: 10315 - Poker Hands
Replies: 63
Views: 27240

Re: 10315 - Poker Hands

You're referring to "real world poker" as Texas hold'em, which is just one of many poker variations. This problem would apply to straight poker, which is another variation of poker also played in the real world - two different five card poker hands drawn from one 52 card deck. Oh okay. Thanks Bryan...

Go to advanced search