Search found 67 matches

by Ryan Pai
Mon Jul 07, 2003 8:04 am
Forum: Volume 1 (100-199)
Topic: 127 - "Accordian" Patience
Replies: 83
Views: 9342

127 WA

Ok, so I'm getting a WA for number 127. If anyone knows a reason why, I'd appreciate the help. [cpp]/* @JUDGE_ID: <My ID> 127 C++ "Simulation" */ #include <iostream> #include <string> #include <vector> #include <queue> using namespace std; queue<string> deck; // the cards in order bool input(); // i...
by Ryan Pai
Mon Jul 07, 2003 5:05 am
Forum: Volume 1 (100-199)
Topic: 110 - Meta-Loopless Sorts
Replies: 92
Views: 7788

Well, posting code can't hurt (it's easier to look for what's going wrong than idly guess at it).

Remember that the first number in the input isn't to be processed, it just tells how many input sets there are.
by Ryan Pai
Mon Jul 07, 2003 3:29 am
Forum: Volume 1 (100-199)
Topic: 110 - Meta-Loopless Sorts
Replies: 92
Views: 7788

Looks like you're doing fine.

The output shouldn't have any space characters printed.

Your output for version A looks fine.

Did you notice that 110 is a multiple input problem?

http://acm.uva.es/problemset/minput.html
by Ryan Pai
Sat Jul 05, 2003 7:00 am
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 12148

This segment of code:

[cpp]
for(i=1;z*i<=n;i++){
seen[x*i]=1;
seen[y*i]=1;
seen[z*i]=1;
}
[/cpp]

runs each time you find any pythagorean triple. Also since 3,4,5 and all multiple of it are triples this will take at the order of (n/5)^2, which for a large value of n will time out.
by Ryan Pai
Fri Jul 04, 2003 10:01 pm
Forum: Volume 1 (100-199)
Topic: 103 - Stacking Boxes
Replies: 200
Views: 19871

Input Case

Try the case where there are two boxes of the same size (they should not be able to fit in one another).
by Ryan Pai
Fri Jul 04, 2003 12:01 pm
Forum: Volume 1 (100-199)
Topic: 107 - The Cat in the Hat
Replies: 278
Views: 20522

Input format

I assumed that the input is of the format: height=(N+1)^a workers=(N)^a for some positive integer N I did include as a special case, height=1,workers=x, but it only seems logical to me that x=1 is the only valid input. (of course I checked that value on my code without the special case and it broke ...
by Ryan Pai
Fri Jul 04, 2003 10:26 am
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 12148

The real way to do this problem

The obvious solution to the problem is to iterate through all x,y,z combinations and check and see if they work. Of course this takes n^3 time which is too long. The easy optimization to see is that once you know two of the variables, you can calculate the third so it's only n^2 now. Of course this ...

Go to advanced search