Search found 67 matches

by Ryan Pai
Wed Aug 04, 2004 1:41 am
Forum: Volume 7 (700-799)
Topic: 725 - Division
Replies: 49
Views: 19669

You don't initialize check[0]. I don't know if that's your only error.
by Ryan Pai
Sat Jul 24, 2004 5:41 pm
Forum: Volume 7 (700-799)
Topic: 702 - The Vindictive Coach
Replies: 5
Views: 7903

It means that: a) If the captain is the shortest player on the team, then the second shortest should be next to him and the pattern should be taller-shorter-taller-shorter-etc. b) If the captain is not the shortest player, then anyone shorter than him can be next to him and the pattern should be sho...
by Ryan Pai
Sun Jul 11, 2004 10:21 pm
Forum: Volume 6 (600-699)
Topic: 632 - Compression (II)
Replies: 13
Views: 5418

632 - Compression (II)

The string can have spaces. That irked me. Don't let it irk you. :roll:
by Ryan Pai
Wed Jun 30, 2004 4:31 pm
Forum: Volume 4 (400-499)
Topic: 430 - Swamp County Supervisors
Replies: 8
Views: 3187

I didn't solve it using a DFS; I tried to prune, but all my efforts came up fruitless. Then I used a fancier algorithm and got AC, at around 7.8 seconds. Which makes me doubt that I did it the "right" way. Of course I was horribly inefficient in my implementation, so maybe that's why.
by Ryan Pai
Sun May 30, 2004 1:22 am
Forum: Volume 3 (300-399)
Topic: 318 - Domino Effect
Replies: 12
Views: 7678

Also if there's a choice outputting "between X and Y." or "at key domino Z", Then output "at key domino Z."
by Ryan Pai
Sat May 15, 2004 6:36 am
Forum: Volume 1 (100-199)
Topic: 196 - Spreadsheet
Replies: 42
Views: 9998

My AC gives the same output (except newlines between spreadsheets).
by Ryan Pai
Thu May 13, 2004 8:04 am
Forum: Volume 2 (200-299)
Topic: 209 - Triangular Vertices
Replies: 51
Views: 6993

I typically use code that looks like this:

[cpp]
string s;
while(getline(cin,s)){
//... stuff
}
[/cpp]
by Ryan Pai
Sat May 01, 2004 12:53 pm
Forum: Volume 1 (100-199)
Topic: 180 - Eeny Meeny
Replies: 34
Views: 9710

Lets say that there are N people in the line and we want to remove every Kth one (in the problem K is always 15) until the last one, F(N), is left. So to start with the line looks like: 1, 2, 3, 4, ... N Ok, so take out the Kth one and it looks like this: K+1, K+2, K+3,.... N, 1, 2, 3, ... K-2, K-1 ...
by Ryan Pai
Sat Apr 10, 2004 3:19 am
Forum: Volume 2 (200-299)
Topic: 285 - Crosswords
Replies: 16
Views: 9192

This is what I'm doing, and it's wrong but I don't know why: a) Build the actual crossword solution as a two dimentional matrix of characters, rembering the size of the matrix b) create a string from that matrix by treating each row as a string and concatenating rows c) removing all spaces from this...
by Ryan Pai
Wed Apr 07, 2004 8:57 am
Forum: Volume 6 (600-699)
Topic: 661 - Blowing Fuses
Replies: 67
Views: 20163

Think of a case like this:

Turning on something really powerful.
Turning it right off.

Logically this should blow a weak fuse.
by Ryan Pai
Fri Aug 15, 2003 2:27 am
Forum: Volume 1 (100-199)
Topic: 138 - Street Numbers
Replies: 93
Views: 7119

A simple property

I'll assume that you realize that this problem is equivalent to finding a pair (k,n) such that 2*k^2 = n(n+1). Once you have this the obvious solution is to just iterate through values of n (or of k) and solve for the other, checking to see if it is an integer. Of course it's equally obvious that th...
by Ryan Pai
Fri Aug 15, 2003 2:02 am
Forum: Volume 1 (100-199)
Topic: 138 - Street Numbers
Replies: 93
Views: 7119

A simple property

I'll assume that you realize that this problem is equivalent to finding a pair (k,n) such that 2*k^2 = n(n+1). Once you have this the obvious solution is to just iterate through values of n (or of k) and solve for the other, checking to see if it is an integer. Of course it's equally obvious that th...
by Ryan Pai
Sat Jul 12, 2003 5:28 pm
Forum: Volume 1 (100-199)
Topic: 117 - The Postal Worker Rings Once
Replies: 58
Views: 16357

Except that the priority_queue doesn't have an update operation, so you lose the efficiency that dijkstra's provides. Ways to work around that would be to use the make_heap and then just write a little fix_heap operation, or perhaps do some wacky stuff with multisets. Any way you slice it, it's not ...
by Ryan Pai
Sat Jul 12, 2003 9:16 am
Forum: Volume 1 (100-199)
Topic: 117 - The Postal Worker Rings Once
Replies: 58
Views: 16357

117 Good idea.

Euler (Yes, the same as the one mentioned in the background) proved a theorem about graphs. And it's one that any computer scientist could prove with a little graph theory and much thought (the amazing thing is that Euler proved it without having any graph theory, for he was the one to invent it). I...
by Ryan Pai
Sat Jul 12, 2003 2:01 am
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 12140

Triples in the second example

Here are the triples that count (x, y, and z are ALL less than or equal to 25)(( I have them separated into groups that are multiples)) 3,4,5 6,8,10 9,12,15 12,16,20 15,20,25 8,15,17 5,12,13 7,24,25 Since there are four such groups, the first number in the output should be 4 Now, take a look at all ...

Go to advanced search