Search found 90 matches

by Minilek
Mon Aug 09, 2004 9:46 am
Forum: Volume 106 (10600-10699)
Topic: 10650 - Determinate Prime
Replies: 67
Views: 24838

I feel this problem needs to state explicitly that if the first number is bigger than the second number, the correct answer is not to print nothing, but rather swap and then check. There seem to be many problems on this site where for some swapping is wrong and some it isn't, and you can't really te...
by Minilek
Mon Aug 09, 2004 2:32 am
Forum: Bugs and suggestions
Topic: 511 - Do You Know the Way to San Jose? - Do nothing AC
Replies: 62
Views: 5114

I changed my code above and got AC. In particular, I took out the following code and put in a recursive function instead: [c] for (i=0;i<26;i++) { for (j=0;j<26;j++) { if (!appear[j]) continue; for (k=0;k<26;k++) { if (!appear[k]) continue; for (l=0;l<26;l++) { if (!appear[l]) continue; if (rel[j][k...
by Minilek
Sun Aug 08, 2004 3:52 pm
Forum: Volume 6 (600-699)
Topic: 612 - DNA Sorting
Replies: 122
Views: 16556

[EDIT] I am dumb. I didn't realize this was a multiple input problem.. grrr...5 WA's for nothing! AC now 8) While we're on the subject... :D Does anyone have some speed tips for this problem? I use modified counting sort to count inversions in O(n), and before I qsort the arrays based on inversion c...
by Minilek
Sun Aug 08, 2004 10:13 am
Forum: Volume 101 (10100-10199)
Topic: 10139 - Factovisors
Replies: 80
Views: 27146

uvdat: from the description of your algorithm I'm not sure where you even use primality. also, it seems like ur algorithm is way too slow. i forgot which was m and which was n, but let's say we're trying to figure out whether m divides n!. now looking at ur algorithm...suppose m is a very large prim...
by Minilek
Sun Aug 08, 2004 5:24 am
Forum: Volume 101 (10100-10199)
Topic: 10179 - Irreducible Basic Fractions
Replies: 28
Views: 9831

A number can have a prime factor greater than its sqrt. That's ok. You only need to generate primes up to sqrt(1 billion) to test primality efficiently. For primes bigger than the sqrt, just loop through the primes less than the sqrt and see if any of them divide it. If not, it must be prime. I use...
by Minilek
Sat Aug 07, 2004 2:56 am
Forum: Volume 101 (10100-10199)
Topic: 10140 - Prime Distance
Replies: 17
Views: 7160

Good luck. Input: 2147483647 2147483647 2146483647 2147483647 1 2 1 10 2 3 2 10 1 1000001 550 9214 500000 1500000 4 5 4 7 5 7 5 5 5 6 1500000 1500001 1500000 1500000 1500006 1500019 1500006 1500018 1500007 1500018 1500007 1500019 1500008 1500019 1500008 1500018 Output: There are no adjacent primes. ...
by Minilek
Fri Aug 06, 2004 10:57 am
Forum: Volume 5 (500-599)
Topic: 565 - Pizza Anyone?
Replies: 12
Views: 4274

Yes, many answers are acceptable, as is indicated by the yellow checkmark.
Ah..so that is what they meant by a "special correction program"..
by Minilek
Fri Aug 06, 2004 9:20 am
Forum: Volume 5 (500-599)
Topic: 565 - Pizza Anyone?
Replies: 12
Views: 4274

the input [c] +A+B+C+D-E-F-G-H; -A-B+C+D-E-F+G+H; -A+B-C+D-E+F-G+H; [/c] I don't know why the output is [c] Toppings: [/c] I think there are not unique answers for this problem. All three of them said they are happy as long as the pizza is -E, so a pizza with no toppings at all is definitely -E and...
by Minilek
Thu Aug 05, 2004 4:44 am
Forum: Bugs and suggestions
Topic: 511 - Do You Know the Way to San Jose? - Do nothing AC
Replies: 62
Views: 5114

I have submitted this problem also, but got WA. Is there something I'm doing improperly ?? I keep checking the last string with the current one and break and update my relation matrix whenever I find a character that is different among the 2. At the end I update the relation matrix to include transi...
by Minilek
Wed Aug 04, 2004 8:59 am
Forum: Volume 5 (500-599)
Topic: 543 - Goldbach's Conjecture
Replies: 109
Views: 24411

Re: right u r

++++ martin , as a matter of regret i heard about the algorithm sieve of Erasthostenes. but i dont feel tempted to write one my self . Hm..I think writing a sieve is not as hard as you think it is. As a matter of fact, it's shorter than your isPrime() function. Here's a sieve: [c] if (isprime[(i-2)...
by Minilek
Wed Aug 04, 2004 7:23 am
Forum: Volume 2 (200-299)
Topic: 278 - Chess
Replies: 22
Views: 2560

For rook and queen it is the minimum of ( row, column). I don't understand..say the board is 2 by 2. Then how can you possibly put 2 queens on the board so that they don't attack each other? Should the answer here not be 1? [Edit] I am foolish..I didn't realize the problem constraints say that m an...
by Minilek
Tue Aug 03, 2004 11:07 am
Forum: Volume 2 (200-299)
Topic: 264 - Count on Cantor
Replies: 47
Views: 13856

0.000 seconds?

I just wanted to ask if there is some even faster trick to solving problem 264. I tried to go all out in terms of speed, but could only get it down to 0.006seconds, but some people on the scoreboards have 0.000. I kept an array of size 4473 which has n*(n+1)/2 for each 0<=n<=4472. Then when given a ...
by Minilek
Tue Aug 03, 2004 10:12 am
Forum: Volume 2 (200-299)
Topic: 256 - Quirksome Squares
Replies: 30
Views: 4741

Is there a way to get printf formatting to have some of the things as variables? Hm..that last sentence was very vague, but this is what I mean. Say I want the following: [c] if (digits==2) printf("%02ld\n",something); else if (digits==4) printf("%04ld\n",something); [/c] etc. Is there some way to g...
by Minilek
Tue Aug 03, 2004 9:20 am
Forum: Volume 1 (100-199)
Topic: 146 - ID Codes
Replies: 35
Views: 5852

your algorithm is wrong. try it on the input "aaccbb".
The correct answer is "ababcc", but I think yours will output
"acacbb".
by Minilek
Tue Aug 03, 2004 3:08 am
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 21852

Thanks! AC.

Go to advanced search