Computer Science Canada

whos doing DWITE?

Author:  zylum [ Mon Oct 18, 2004 4:58 pm ]
Post subject:  whos doing DWITE?

first one is on friday october 29th. its from 11-2pm.

Author:  Andy [ Mon Oct 18, 2004 5:00 pm ]
Post subject: 

i'll be doing it...

Author:  Mazer [ Mon Oct 18, 2004 5:06 pm ]
Post subject: 

Yay dwite! I'm on dodge's team!

Author:  Andy [ Mon Oct 18, 2004 5:30 pm ]
Post subject: 

sweet.... operation dwite h4x0r is underway

Author:  Mazer [ Mon Oct 18, 2004 5:37 pm ]
Post subject: 

STFU Noobiezor! They are t3h gonna knowz about j00 and /\/\y t3h plan! (You know what I'm talking about, right?)

Author:  Andy [ Mon Oct 18, 2004 5:39 pm ]
Post subject: 

yup

Author:  AsianSensation [ Wed Oct 20, 2004 2:26 pm ]
Post subject: 

do we register ourselves or do we have to have McKenzie register for us?

Let's all haxx0rz teh cont3stz0r.

Author:  AsianSensation [ Wed Oct 20, 2004 2:30 pm ]
Post subject: 

actually, I just read the rules of DWITE, they released new rules regarding submission and stuff like that.

I think now you have to attach source codes instead of exe programs and you are only allowed to send in two solutions, like the ARML relay questions.

that kind of hinders the l33t haxx0rn3ss of teh programz0r.

Author:  Andy [ Wed Oct 20, 2004 2:51 pm ]
Post subject: 

stfu azn, ur not in wit me and coutsos...

Author:  Mazer [ Wed Oct 20, 2004 3:39 pm ]
Post subject: 

*frown*
my evil planning...

Author:  timmytheturtle [ Wed Oct 20, 2004 6:11 pm ]
Post subject: 

what is this DWITE? you are talking about

Author:  Paul [ Wed Oct 20, 2004 6:28 pm ]
Post subject: 

www.dwite.org

the next one is coming up soon, I've gotten in my newbie team of 4.

Author:  Martin [ Thu Oct 21, 2004 12:14 am ]
Post subject: 

Jack and I won it once.

Author:  bugzpodder [ Thu Oct 21, 2004 4:30 pm ]
Post subject: 

darn... i have classes for about an hour during that period... I'm still debating if i should chun an account to submit stuff. i see they have a new website and new rules. interesting...

Author:  Martin [ Thu Oct 21, 2004 5:02 pm ]
Post subject: 

Let's do it again!

We'll misrepresent Massey!

Author:  bugzpodder [ Sat Oct 23, 2004 8:37 am ]
Post subject: 

will sentjens has agreed to let me put some of my problems on dwite starting november so be prepared to get pwned!! j/k (just the part about being pwned -- the problems are not tooo difficult, it should be easily accessible to high students - esp massey student 8) , and you might see 2 or 3 problems from me on november though, thats the truth)

Author:  Andy [ Sat Oct 23, 2004 9:47 am ]
Post subject: 

heh nice...

Author:  Paul [ Sat Oct 23, 2004 5:01 pm ]
Post subject: 

bugzpodder wrote:
will sentjens has agreed to let me put some of my problems on dwite starting november so be prepared to get pwned!! j/k (just the part about being pwned -- the problems are not tooo difficult, it should be easily accessible to high students - esp massey student 8) , and you might see 2 or 3 problems from me on november though, thats the truth)

Easy for you to say, Mr. Algorithms

Author:  shorthair [ Sat Oct 23, 2004 7:25 pm ]
Post subject: 

CCH = IN the DWITE

Good luck to those in it

Just like last year , here is how the contest goes , the winnig team will split the bits depending on how many are on hte compsci board

so if CCH won , Shorthair & Sport would split , 500 bits.

Bits go at my discresion , if hte user is inactive on the board then let me know and you can have all hte bits


1st = 500 bits
2nd = 250 bits
3rd = 125 bits

Later Days ,

Beat you all friday Very Happy Very Happy Very Happy

Author:  bugzpodder [ Sat Oct 23, 2004 11:18 pm ]
Post subject: 

seriously though, you will not be needing any "advanced" algorithms to solve my problems. in fact, as mr. sentjens adviced, the problems should be in a way thats accessible to grade 11 students. which means it usually wont have anything that you havent seen in your classes in grade 11 (but including recursion in case thats not taught in grade 11).

Author:  pluckster [ Wed Oct 27, 2004 11:17 am ]
Post subject: 

Me and some of my friends are doing it from Ross in guelph

Author:  zylum [ Wed Oct 27, 2004 8:19 pm ]
Post subject: 

bah! my teacher is a lazy dick, he wont sign my team up because he doesnt want to arrange a substitute for the classes he wont be teaching. i suspect hes just being lazy as usual Mad Evil or Very Mad

Author:  sport [ Wed Oct 27, 2004 10:33 pm ]
Post subject:  Dwite

We almost missed the registration too. We better win it this time shorthair.

Author:  bugzpodder [ Thu Oct 28, 2004 12:59 pm ]
Post subject: 

Simon is pretti good... you need some work to beat him. I managed to do that with AsianSensation's help Smile

Author:  Andy [ Thu Oct 28, 2004 5:12 pm ]
Post subject: 

wait when was this?

Author:  zylum [ Thu Oct 28, 2004 9:10 pm ]
Post subject: 

yay, i got another teacher to sign us up! he did it today and we still made it Very Happy well good luck to you all tomorrow!

Author:  bugzpodder [ Thu Oct 28, 2004 9:24 pm ]
Post subject: 

dodge_tomahawk wrote:
wait when was this?

is that addressed to me? last dwite. btw the massey team looks good. I just hope mr Sentjens uses my questions next time. Very Happy i sent them in last week and he havent given me responses yet.

Author:  bugzpodder [ Fri Oct 29, 2004 11:46 am ]
Post subject: 

Hmm Aidin and Simon are pretti fast. half way in and they are almost done (dont know whats happening with question 3)

and dodge, wth is all those "Input/Output file not found" in your submissions for Q1!!

Author:  zylum [ Fri Oct 29, 2004 3:11 pm ]
Post subject: 

man that contest was so damn easy. too bad we had problems with submitting... i finished all problems in about 40 minutes but my teacher had gone off somewhere and we couldnt submit the solutions untill an hour and a half into the contest... then we submitted all the problems at once (thats why the scores are similar) but for some reason they werent accepting solutions for 2 and 4.. i dunno, we emailed the guy and he said he couldnt open the files or something. meh if those 2 were accepted we could have had a score of around 625 putting us in second and if we were able to submit them at the time we had finished them we would have probably finished in fourth...

here are the solutions for my 2 and 4.... they worked on the computer i was using and passed all test that i threw at it so im sure it would have passed if it we didnt have those problems:

P2:

code:
var file : int
var out : int

var input : string
var output : string
open : file, "DATA2", get
open : out, "OUT2", put

loop
    exit when eof (file)
    get : file, input
    var hours : int := strint (input (1 .. 2))
    var minutes : int := strint (input (4 .. 5))
    var half : char
    var HH: string
    var MM: string
   
    if (hours > 12) then
        hours := hours - 12
        half := "P"
    elsif (hours = 12) then
        half := "P"
    else
        half := "A"
    end if
   
    if (minutes <10) then
        MM := "0" + intstr(minutes);
    else
        MM := intstr(minutes);
    end if
    HH:= intstr(hours)   
    output := HH + ":" + MM + " " + half + "M"

    put : out, output
end loop


P4:

code:
var file : int
var out : int
open : file, "DATA4", get
open : out, "OUT4", put

var MAX : int := 0
var ret : int := 0
var temp : int := 0
var numF : int
var maxSize : int
var files : flexible array 1 .. 0 of int
var bMask : string


function intToBin (n, l : int) : string
    var num : int := n
    var bin : string := ""

    for i : 1 .. l
        bin := intstr (num rem 2) + bin
        num := num div 2
    end for
    result bin
end intToBin


loop
    ret := 0
    exit when eof (file)
    get : file, MAX
    get : file, numF
    new files, 0
    new files, numF
    for i : 1 .. numF
        get : file, files (i)
    end for
    for i : 1 .. 2 ** numF - 1
        bMask := intToBin (i, numF)
        temp := 0
        for j : 1 .. numF
            if bMask (j) = "1" then
                temp := temp + files (j)
            end if
        end for
        if temp <= MAX and temp > ret then
            ret := temp
        end if
    end for
    put : out, ret
end loop


we were using turing 4.1 but i dont think i used anything that wouldnt be compatible with turning 3...

also, it seems lots of people were having trouble with the 3rd problem... i dont know why because it seemed to be one of the easier ones. i was one of two teams that got perfect for that one Confused

Author:  Andy [ Fri Oct 29, 2004 5:17 pm ]
Post subject: 

haha we did number four the same way... i guess most ppl did that way instead of recursion

Author:  zylum [ Fri Oct 29, 2004 6:37 pm ]
Post subject: 

yeah but why would they have trouble compiling those two?

Author:  Andy [ Fri Oct 29, 2004 7:22 pm ]
Post subject: 

what was the exact error msg they gave?

Author:  zylum [ Fri Oct 29, 2004 9:05 pm ]
Post subject: 

Can Not Execute File: Problem2.t and
Can Not Execute File: Problem4.t

doest seem anything wrong with my code and it compiled successfully at school..

Author:  Andy [ Sat Oct 30, 2004 9:45 am ]
Post subject: 

hmmmm that is weird..

Author:  zylum [ Sat Oct 30, 2004 9:51 am ]
Post subject: 

i know and if it werent for that i would have been second place!

if anybody still has turing 3 on their computer (yeah right Laughing) can you please try running the code i posted?

Author:  Andy [ Sat Oct 30, 2004 9:53 am ]
Post subject: 

they're not using turing 3... they're using a dos complier.. so any net commands, object oriented commands, and graphical commands wont work well

Author:  zylum [ Sat Oct 30, 2004 9:57 am ]
Post subject: 

huh... well then i dont see anything wrong with the code. i wonder what the problem was. if it was a problem on my end id really like to know so i dont make the same mistake twice Confused

Author:  Andy [ Sat Oct 30, 2004 10:00 am ]
Post subject: 

or just learn c++

Author:  zylum [ Sat Oct 30, 2004 10:04 am ]
Post subject: 

i wanted to use java but my welfare school doesnt have it installed. i told my teacher to hook me up but he ended up installing ready to program! lmao i dont think RTP even compiles into class files Laughing

Author:  Andy [ Sat Oct 30, 2004 1:19 pm ]
Post subject: 

haha.. y not just get jcreator? its free.. well at least the LE edition is..

Author:  Martin [ Sat Oct 30, 2004 2:59 pm ]
Post subject: 

Eclipse is where it's at.

Good job to everyone who wrote the dwite. Very Happy

Author:  zylum [ Sat Oct 30, 2004 4:50 pm ]
Post subject: 

for jcreator, dont you still need the jre 1.4.* installed?

Author:  bugzpodder [ Sat Oct 30, 2004 4:53 pm ]
Post subject: 

or you can download the command line compiler provided on dwite homepage

Author:  zylum [ Fri Nov 05, 2004 7:34 pm ]
Post subject: 

yay, it turns out it was their mistake. they fixed it and i finished 3rd place...

Author:  Paul [ Mon Nov 08, 2004 6:46 pm ]
Post subject: 

I heard java outputs differently on their marking program. It might work perfectly fine, but it might show up differently.

Author:  zylum [ Thu Nov 25, 2004 3:55 pm ]
Post subject: 

there's a dwite contest tomorrow... goodluck to everyone writing Wink

Author:  bugzpodder [ Thu Nov 25, 2004 5:45 pm ]
Post subject: 

i never got any reply from mr sentjens after i sent him my problems. so i am supposing they wont show up tomorrow

Author:  zylum [ Thu Nov 25, 2004 5:46 pm ]
Post subject: 

good! lol, i dont want anything crazy on it Wink

Author:  bugzpodder [ Fri Nov 26, 2004 11:00 am ]
Post subject: 

okay, he put one of the two questions i sent him. its Q3

Author:  Viper [ Fri Nov 26, 2004 12:50 pm ]
Post subject: 

what is DWITE ??

Author:  bugzpodder [ Fri Nov 26, 2004 1:23 pm ]
Post subject: 

www.dwite.org

Author:  Paul [ Fri Nov 26, 2004 3:29 pm ]
Post subject: 

DAMN YOU bugz! I didn't know enough math to do the number 3 by you! Stupid factoring. We did number 1, 2, and 5 though, I almost finished 4... and somehow my 1 got a 0, although it worked perfectly, according to the output specifications...

but that simon guy though, from KCI ... the guy works alone and finishes all of them perfectly in 20 minutes -_-

Author:  zylum [ Fri Nov 26, 2004 3:35 pm ]
Post subject: 

that was ghey... im never donig dwite again unless they let me install java Confused

string manip in turing is so damn ghey omg! and for some reason they only accepted my solutions for 1 and 2 but not 4 and 5.. not even an error message!

Author:  Paul [ Fri Nov 26, 2004 3:41 pm ]
Post subject: 

zylum wrote:
that was ghey... im never donig dwite again unless they let me install java Confused

string manip in turing is so damn ghey omg! and for some reason they only accepted my solutions for 1 and 2 but not 4 and 5.. not even an error message!


You go to the online judge for errors
my 1 worked, didn't accept, 2 timed out :S stupid ... and 3... I had a clever idea for 4, didn't get done though... and 5 worked, for some weird reason.
and yes, string manipulation is ... damned stupid, in turing.

Author:  Andy [ Fri Nov 26, 2004 3:55 pm ]
Post subject: 

o haha nice bugz.. its not too bad tho... just use the factor theorum and ur set

Author:  bugzpodder [ Fri Nov 26, 2004 5:05 pm ]
Post subject: 

dodge, you were supposed to participate and be the fastest one to get it!! factor theorem is not enough... you need synethetic division to get the multiple roots, or you can take derivatives to get those multiple roots

Author:  bugzpodder [ Fri Nov 26, 2004 5:09 pm ]
Post subject: 

of course, you also need to worry about x=0 as a root and then apply rational roots theorem. i havent seen the test cases so i am not sure any of those applies. Mr Sentjens make the test cases so Simon might have sneaked past this question without doing some of this.

Author:  evogre3n [ Fri Nov 26, 2004 8:41 pm ]
Post subject: 

I wrote the competition, and I totally agree about the string manip, we got stuck because of it Sad (we, as in my team) and that guy from KCI, freaking machine im guessing Razz 20min and solves all problems... crazy.

My team did pretty well, and im not even learning turing yet, (take it for first time next semester (gr. 9) i just picked it up myself with help from friends.

Anyway, it was fun, and congrats to those who did well!

Author:  bugzpodder [ Fri Nov 26, 2004 11:12 pm ]
Post subject: 

nah... not my problem in twenty minutes Smile

Author:  zylum [ Sat Nov 27, 2004 12:07 am ]
Post subject: 

he submitted his last solution an hour and 52 minutes after the contest started Wink

Author:  Paul [ Sat Nov 27, 2004 12:39 am ]
Post subject: 

Still, he might be #1 for the CCC.

Author:  zylum [ Sat Nov 27, 2004 3:27 pm ]
Post subject: 

that set was relatively simple in my oppinion except for maybe bugzpodders problem.. P1 P2 and P5 were really easy. P4 could have easily been done using simple recursion or just some looping, and if you know the math P3 wouldnt have been that hard although it was the hardest problem in the set thanks to bugzpodder Wink

Author:  bugzpodder [ Sat Nov 27, 2004 3:29 pm ]
Post subject: 

Paul, somebody's gotta take #1 Wink

thx zylum... but the math isnt that hard right? it is high school factoring, and i think everyone knows how to factor??

Author:  Andy [ Sun Nov 28, 2004 2:26 pm ]
Post subject: 

o rite bugz.. yea u need to take the derivitive to see if there are double roots... but i dont think u really need synthetic division... since the roots are integers

Author:  bugzpodder [ Sun Nov 28, 2004 2:44 pm ]
Post subject: 

the roots are rational numbers. synthetic division divides out the double roots (instead of using derivatives)
why didnt you participate?

Author:  Andy [ Sun Nov 28, 2004 3:04 pm ]
Post subject: 

calculus/algebra midterms on that same day.. during the contest

Author:  thegoose [ Mon Jan 03, 2005 11:56 am ]
Post subject: 

Just wondering, who is doing the DWITE edition II on January 11th? (check the DWITE site for more details)

Author:  bugzpodder [ Mon Jan 03, 2005 12:40 pm ]
Post subject: 

Here is a set of problems richard sent me... you can anticipate these type of problems on the dwite...

Author:  bugzpodder [ Mon Jan 03, 2005 12:43 pm ]
Post subject: 

Problem 1: Cannon
Made by: Simon Parent

Sharktooth Pete has finished the construction of his awesome cannon. So, he walks to point (0,0) at the testing range, facing in the positive x-direction (X marks the spot, yarr!), and prepares to test his masterpiece. What he most wants to impress people with, however, is the accuracy of the cannon. Therefore, he wants to be able to mark the point where the cannonball will land (within one metre). To this end, he has commissioned you to write a program for him that will calculate where it will land given some initial conditions. He has gathered data on the shape of the terrain, in the form of a series of points.

Sharktooth Pete also remembers from his physics class that the x and y positions of the cannonball at time t will be:
xt = vtCos(θ)
yt = vtSin(θ) - 0.5gt²

Input: (cannon.in)
10 test cases, each case is as follows:
Line 1: v, the velocity in m/s, 0 <= V <= 100
Line 2: θ, the angle up from horizontal the cannon is aimed, 0 <= θ <= 90
Line 3: g, the constant of acceleration due to gravity in m/s², 0 <= g <= 100
Line 4: N, the number of points in the terrain curve, 2 <= N <= 10000
Line 5~N+4: he coordinates of the N points, -10000 <= X, Y <= 10000, two per line.

The terrain curve will be given in order from left to right and it will not double back on itself. That is, the X coordinates will be strictly increasing.
All numbers in the input file are integers.
Sharktooth Pete will always be standing on the terrain curve (pirates don't float well).

Output: (cannon.out)
You will output two numbers for each test case on one line: the coordinates that the cannonball lands at, rounded to the nearest integer.


Sample Input (1 test case):
20
30
10
2
0
0
50
5

Sample Output:
29 3

Test Case Sizes:
Test Case N
1 2
2 11
3 100
4 100
5 100
6 2
7 3
8 1000
9 1000
10 10 000


Problem 2: Goose Game
Made by: Richard Peng

Yes, you heard it right. The geese are smart enough to invent games (somebody got to stop teaching them math). They invented the game with the following rule and have challenged you to play it.
You are given two finite sequences of positive integers. The game consists of making consecutive moves. You are allowed to make the following move. You remove the last K1 numbers (K1≥1) from the first sequence (possibly the whole sequence) and find their sum S1 and the last K2 numbers (K2≥1) from the second sequence (again you can remove the whole sequence) and find their sum S2. Then you calculate the cost of the move to be (S1 - K1)*(S2 - K2). You continue to make moves until you remove all the numbers in both sequences. The total cost of the game is the sum of the costs of all moves. Your goal is to minimize this total cost. You are not allowed to leave one of the sequences empty, while the other is not.
The geese, however smart they maybe, are not able to realize that there exist an optimal way to play this game. However, you realize that it is easily solvable with the help of a computer, so you decide to write a program GAME, that computes the minimum total cost of the game.

Input: (game.in)
Input data is read from the file. Each test case consists of three lines.
Line 1: two space-separated integers, L1 and L2 (1 ≤ L1, L2 ≤ 2000), which denote the lengths of the two sequences.
Line 2: L1 space-separated integers, which are the elements of the first sequence. Line 3: L2 space-separated integers, which are the elements of the second sequence.
The elements of the sequences do not exceed 1000.

Output: (game.out)
Your program has to output one line per test case to the file contains only one number - the minimum total cost of the game as described above.

Sample Input (1 test case):
3 2
1 2 3
1 2

Sample Output:
2

Test Case Sizes:
Test Case L1 L2
1 20 20
2 110 80
3 200 130
4 400 80
5 1000 333
6 510 910
7 1200 1400
8 700 1800
9 1998 1370
10 2000 1999


Problem 3: Dummy Code
Made by: Aidin Kashigar

The Dummies are a group of genetically-modified human beings. Unlike us normal beings, they see everything as numbers. They live by numbers and they talk by numbers. So, one would not be surprised to see them communicate using a written sequence of numbers.

One of the Dummies, who happens to be an excellent programmer, has faced a programming challenge. He is a teacher of the language of the Dummies. This language, which clearly consists of a sequence of numbers, is more formally known as GieLle. The teacher is given three essays, written in GieLle and with lengths L1, L2, L3 <= 1000, and he has to find the longest increasing subsequence of number in the writing. Call it a plagiarism detection machine or just a plain old Dummies Problem.

You are to help this Dummy by outputting the length of the longest common increasing subsequence of numbers in the three essays.

Input: (dummy.in)
The input consist of 10 test cases with each two cases separated by a blank line, each case consist four lines:
Line 1: L1, L2, L3, the length of the three essays.
Line 2: L1 numbers that make up the 1st essay.
Line 3: L2 numbers that make up the 2nd essay.
Line 4: L3 numbers that make up the 3rd essay.
All numbers are guaranteed to fit in a signed 32-bit integer.
The values of L1, L2 and L3 for each test case are:

Output: (dummy.out)
For each test case, print one number on a line by itself. The length of the longest common increasing subsequence.

Sample Input (1 test case):
3 3 3
1 2 1
2 1 2
1 3 2

Sample Output:
2

Explanation:
The dummy sequence is 1,2.

Test Case Sizes:
Test Case L1 L2 L3
1 5 5 5
2 10 10 10
3 20 100 100
4 50 100 100
5 100 100 100
6 100 1000 1000
7 200 1000 1000
8 500 1000 1000
9 1000 1000 1000
10 1000 1000 1000


Problem 4: The Insane Geese
Made by: Richard Peng

The Geese have gone insane!!! They plan to dig a series of tunnels connecting the trees they live in. This way, they hope to be able to communicate and travel from any tree to any other tree without being above the ground. Since the geese lives in a populated area, any such construction would cause major disruption. As a result, the geese have asked you to find the construction plan which will cause the least disturbance (which means the total length must be kept the shortest possible). You are to write a program that reads 10 data sets, each containing a set of points. The program is to output the least possible total length which a network that connects all the points.

Input: (insane.in)
Each input contains 10 test cases with every two cases are separated by a blank line. Each case contains:
Line 1: one number, N, the number of locations (trees)
Line 2~N+1: 2N numbers, two per line, the coordinates of the locations of the trees on a Cartesian plane.
All coordinates are guaranteed to fit in a 16-bit signed integer.

Output: (insane.out)
The output consists of 10 lines, each containing the output to the respective case rounded to 2 decimal places. If less than 10 lines are outputted before the program was terminated, the lines that were outputted will be marked against the correct answer of case 1, 2, 3"¦ respectively.

Sample Input (2 test cases):
3
0 0
0 1
1 0

4
0 0
3 3
4 4
6 6

Sample Output:
2.00
9.90

Explanation:
Case 1: Connect the 1st point to the 2nd and 3rd.
Case 2: Connect the 2nd to the 1st, 3rd and 4th.

Test Case Sizes:
Test Case N
1 10
2 10
3 1 000
4 1 000
5 1 000
6 100 000
7 100 000
8 100 000
9 100 000
10 1 000 000


: