Search found 16 matches

by klavierspieler21
Tue Aug 10, 2010 11:45 pm
Forum: Crossflip
Topic: Code optimization
Replies: 57
Views: 156000

@Zeta: Yeah I think I'm inherently really lazy lol.. I was hoping not having to pack multiple bools in an int. It becomes a hassle when I want to find the right pivot and checking for stuff like that, and on top of that there is ensuring the padding is done correctly when your data is not of length ...
by klavierspieler21
Tue Aug 10, 2010 3:32 am
Forum: Crossflip
Topic: Code optimization
Replies: 57
Views: 156000

Holy fuck I just cut down my running time for lvl150 from >100s to 17s and my memory usage from megabytes to kilobytes just by setting the right compiler flags and changing my chars to longs (32 bits)!! I guess with those flags on, it effectively does the multiple bit operations that I wanted. There...
by klavierspieler21
Tue Aug 10, 2010 12:33 am
Forum: Crossflip
Topic: Code optimization
Replies: 57
Views: 156000

@CodeX: Oh I didn't know about the joint firstness lol. Yeah one day I'll recode that thing and I'll get to 513 easy peasy :) In fact, I didn't even code this version myself. It was exam time and my friends wanted me to give them practice questions. So I broke the problem down into individual functi...
by klavierspieler21
Mon Aug 09, 2010 1:42 am
Forum: Crossflip
Topic: Code optimization
Replies: 57
Views: 156000

I haven't finished Runaway because I'm lazy :P I coded it up after my first introductory course in computer science at Waterloo (I never programmed before, unless you count html lol). We used Scheme as an intro language. Clearly I did not understand memory management and call stacks after 4 months.....
by klavierspieler21
Mon Aug 09, 2010 1:34 am
Forum: Crossflip
Topic: Code optimization
Replies: 57
Views: 156000

I'm at 1.87Ghz, -O3 C++, lvl 224 is 91x91 so 8281 variables (I kept the duds for simplicity), and I'm taking over 10 minutes. Something must be wrong... =[
by klavierspieler21
Sun Aug 08, 2010 9:55 pm
Forum: Crossflip
Topic: Code optimization
Replies: 57
Views: 156000

heh tried that already :P with -O3 it's still taking me slightly more than 10 mins at lvl 220 something.. compiler can't help if i'm incompetent lol
by klavierspieler21
Sun Aug 08, 2010 6:22 pm
Forum: Crossflip
Topic: Code optimization
Replies: 57
Views: 156000

Code optimization

I coded my solution to crossflip in C++ but I didn't get the speed I expected... I know my algorithm is asymptotically near optimal (I didn't try to understand how to solve a matrix in under O(n^3) time over the Z_2 field), but I don't know much about low-level optimization techniques. Anybody care ...
by klavierspieler21
Sun Jul 19, 2009 7:17 pm
Forum: Challenges Solved
Topic: Broken Keys
Replies: 15
Views: 1438

Broken Keys

I "solved" this by using the fact that max(a,b) = (|a-b|+a+b)/2, and Newton's method to calculate the square root of (a-b)^2. However, it shouldn't have passed when a-b = 0 because I'm dividing by 0 in newton's method. I got error messages but I still "passed"... Here's my code: ...
by klavierspieler21
Wed Jul 08, 2009 7:28 pm
Forum: Challenges Solved
Topic: Random Problem
Replies: 11
Views: 926

i think you've mistaken with another challenge public int bucketFromRandom(int randomNumber) { int a[] = new int[10]; for (int i = 0; i < a.length; i++) a = i * randomNumber; int index = Math.abs(randomNumber) % a.length; return a[index]; } this has no reference to an actual random number. i just tr...
by klavierspieler21
Tue Jul 07, 2009 12:48 pm
Forum: Challenges Solved
Topic: Random Problem
Replies: 11
Views: 926

re:
by klavierspieler21
Fri Jul 03, 2009 4:54 pm
Forum: Challenges Solved
Topic: Primal Pi
Replies: 8
Views: 628

I used a simple nested loop in Maple, which has the function isprime(n). And the first prime I found, in decreasing string length, was outputted.

:P
by klavierspieler21
Fri Jul 03, 2009 2:18 am
Forum: Challenges Solved
Topic: Random Problem
Replies: 11
Views: 926

Random Problem

I don't know Java much... I did mostly Scheme, and a bit of C.
Anybody care to explain why -2^31 failed?

Thx
by klavierspieler21
Mon Jun 22, 2009 11:43 pm
Forum: Challenges Solved
Topic: Telecran
Replies: 24
Views: 1933

omg the luxemburg flag looks almost the same as netherlands
by klavierspieler21
Thu Dec 11, 2008 2:59 am
Forum: General Puzzles
Topic: Automatic submitting
Replies: 4
Views: 21735

wow thanks o.O i'm learning so much here its incredible... i'll play around to get familiar with this.. right now i'm working on an efficient Runaway algorithm (still in scheme though...). if its actually as good as i'm thinking it is, it should get me up to 513 like all of you up there :P oh and bt...
by klavierspieler21
Wed Dec 10, 2008 11:40 pm
Forum: General Puzzles
Topic: Automatic submitting
Replies: 4
Views: 21735

yeah i tried going through the python script, but i couldn't figure out how to extract the "get and submit" part of it.

can someone be kind enough to explain the gist of it?