Computer Science Canada

so how did you guys do on this years CCC?

Author:  zylum [ Tue Feb 24, 2004 4:31 pm ]
Post subject:  so how did you guys do on this years CCC?

just wondering how everyone did... i only finished the first 4 questions Sad

-zylum

Author:  Asok [ Tue Feb 24, 2004 5:48 pm ]
Post subject: 

The Senior this year seemed to have a lot more "confusing wording" than last year. Those Waterloo asshats! Mad

Author:  zylum [ Tue Feb 24, 2004 5:49 pm ]
Post subject: 

so how did you do???

Author:  limited_skillz [ Tue Feb 24, 2004 5:53 pm ]
Post subject: 

i did the first four pretty easily, but i think somethings wrong with my fourth one (im a junior)

occasionaly i would get an odd character in my encoding message like "☼" or something

the last one was impossible, i started with an hour left.. asked 3 teachers, they couldnt help much, brought in a genius to do it, it took a while but they finally got it and explained it to me

its definately not right, but i put some code down

i dont think any gr. 11 could get that, they deserve to win if they could

Author:  zylum [ Tue Feb 24, 2004 6:11 pm ]
Post subject: 

you're allowed to ask for help from ppl???

is the junior last one the spread sheet one???

Author:  nate [ Tue Feb 24, 2004 7:22 pm ]
Post subject: 

For junior the first 3 were so simple, the 4th one took about 20min, and i by the time i understood the crappy wording of J5 there wasn't enough time left to actually do it.

And how can u get help from another person (isn't there sapposed to be no talkin?)

Author:  Mazer [ Tue Feb 24, 2004 7:49 pm ]
Post subject: 

Supposedly you aren't supposed to be talking, like an exam or a math contest, but some of the students were having little conversations about the contest while writing. Nothing like giving each other hints or anything, just stuff like "why the hell do we have to take input from the keyboard this year?!" or "yay, my recursion is working" or "wouldn't that suck if nobody made it to stage 2? We'd be so pissed off... well, not you, you've got your recursion to keep you happy."

But seriously, why did they switch to keyboard input only all of the sudden? I didn't even know about it until half way through the contest, were they expecting me to read the rules?

Author:  Tony [ Tue Feb 24, 2004 7:50 pm ]
Post subject: 

bah, senior was insane Confused I'm guessing they got new staff to make it cuz the contest has a compleatly different feel to it. And this year Juniors/Seniors had no questions incommon Confused

Anyways, I finished S1, S2 and S5. S4 I didnt even start (seemed too confusing from the beginning) and S3 was really buggy when I ran out of time Rolling Eyes

as for input - I was wondering out that too... and for S5 I said - screw it, I'm not retyping the damn maze map every time and just made it load from a datafile... if anyone complains - screw you. The contest was hard enough as it is

Author:  Brightguy [ Tue Feb 24, 2004 8:30 pm ]
Post subject:  Re: so how did you guys do on this years CCC?

Well, this was my first year writing the contest (I didn't even know about it last year). All my solutions were written in Visual Basic.

Overall I enjoyed it and thought some of the questions were really challenging. I would have liked to finish all the questions, but unfortunately I ran out of time. (Most of my time was spent on the spreadsheet question.) I managed to finish S1, S2, and S3. Now I'm just hoping there aren't any bugs in them...

By the way, I thought there were supposed to be three middle problems common to both the junior and senior division? (On that sheet where you filled out your name it had the problems listed as J3S1, J4S2, J5S3.) Anyway, once I finished the first three seniors I thought "I don't have enough time to complete the final two senior problems (I had less than an hour remaining), but I could do the first two juniors and at least have a really good junior score." So I completed the first two juniors easily... but it turns out the problems don't overlap. So I did enter the senior division after all, but only with the first three problems done.

Question... If you just made a program that just outputs "0", would you still get points if a test case happened to have a 0 output? Very cheap...

Author:  TheZsterBunny [ Tue Feb 24, 2004 8:40 pm ]
Post subject: 

This was my first CCC. I took the junior one this year. I'm wondering if they set the questions up in the order on purpose. I finished questions j1,j2,j3 in the first 15 minutes. I then took 2 hours on j4 and had no idea about j5. if anyone knows how to do it, please reply.

I tried using whatdotcolor, and it helped quite a bit Laughing , however I lacked the math background to do the question.

*sigh*

-bunny

-----

but seriously, none of the programs needed more than 40 lines of code.

I think i did j4 in 26 lines. I can't remember.

but j1 was pretty much this (this is not cut and paste, it is typed here, excuse errors please)

code:

var ino : int % input number
loop
put "Enter a number: "..
get ino
put "The Largest square you can make is ", floor (sqrt(ino)),"."
end loop


J5 used fractals.

Author:  Brightguy [ Tue Feb 24, 2004 8:44 pm ]
Post subject:  Re: so how did you guys do on this years CCC?

Mazer wrote:
But seriously, why did they switch to keyboard input only all of the sudden? I didn't even know about it until half way through the contest, were they expecting me to read the rules?

Huh... Did I read something wrong? It looked to me like most of the questions were expecting input from a data file. I thought only J1 and J2 wanted keyboard input (they had the title "Sample Session" instead of "Sample Input").

On the advice sheet I got, it says:
5. For each problem where input is required, the structure of the data file is explained in the description of the problem and a sample data file is printed on the problem sheet, together with the expected output.

Author:  Chimaera [ Tue Feb 24, 2004 8:48 pm ]
Post subject: 

so I guess it wasn't only me and my friends who felt stupid writing the questions, the questions were TOTALLY different from previous years.

damnit! I wish i knew how to do my sorting perfectly so I could get full marks on the s2 which was the yodeller one and s1 which was the 'fix' one Mad

I actually found S4 the easiest one of them all, I finished that one last and I didn't even bother with S5, it's too damn complicated to truncate the whole line of input and then slowly sort through it one by one and make sure that the whole thing is aligned to the right grids....I suppose it'd be much easier doing that one using a Visual language ie. VB but I'm not too familiar with it... Rolling Eyes

sigh....I just hope I scored fairly well letalone go onto stage 2....btw does Massey send people to stage 2 every year?

Author:  Andy [ Tue Feb 24, 2004 8:54 pm ]
Post subject: 

lol azn_s finished the junior 1-4 in ten min, i swear, i sat beside him, then he had 2 hrs and 50min for j5 and he couldnt do it... should've just hard coded it with a million ifs

Author:  StrikerMagazine [ Tue Feb 24, 2004 9:46 pm ]
Post subject: 

Eh.. i wrote senior but probably didn't do very well. i did s1, s2, s3 (works mostly) and s4.. (uh..) i couldn't think of any other way to do s4 at the time except break it into cases. (i pretty much ran out of time doing the cases.. there's so many...) i was surprised by the keyboard input thing too. None of the practice sheets were like this... i ended up using a datafile and then changing it to keyboard later. i wonder if the poor person marking it has to type all that out (it must be marked some other way?)
the questions themselves this year seemed a different style from the ones in previous years (or maybe it's just me..) i did a good number of ?s from previous contests for practice but now that i think of it maybe it didn't help so much(..!)
.. i'm just so glad it's over (..!)

Author:  limited_skillz [ Tue Feb 24, 2004 9:53 pm ]
Post subject: 

i think i messed up on j4 to think about it

this is what i did

made an array of the alphabet 1..26
fed the letter in through ascii

made the key an array which matched up same letters with the alphabet array and put them according to i


i dont know how i did the part where it is suppose to be in columns, thats why i think i messed up

Author:  Chimaera [ Tue Feb 24, 2004 9:54 pm ]
Post subject: 

wow....i really don't understand how some people had such a hard time with S4, S4 was really easy. There were 3 things to do, declare the 7 variables, they even gave em to you, sx, sz, sy and tx,ty,ty and distance between your current position and the desired destination. The last variable, you had to figure out yourself the distance formula for. Then you would get the values for sx, sz, sy, tx, tz, ty from user. After getting the values, then you would loop a get for 2 things, an integer value for the distance travelled and the string value for Up, Down, Left, Right. Then depending on whether it was left/right, up/down, you add or subtract to the tx, tz, ty variables, also add in the elsif condition of invalid input. I just followed the input format of the sample input and output format of sample output. The hardest part about the whole problem was the distance formula. Probably the 1st or 2nd most straight forward problem there was in the whole senior problem set. But S1, whoooo.....now that's a question I totally didn't understand.

Author:  Andy [ Tue Feb 24, 2004 10:01 pm ]
Post subject: 

wow... s4 is not easy, u dont even understand how the question works... its not lattice points...

Author:  Tony [ Tue Feb 24, 2004 10:03 pm ]
Post subject: 

StrikerMagazine - the questions did have a new style to them, its not just you Rolling Eyes

and damn... I should have probably been working on S4 instead of S3 Confused

Chimaera - S1's really confusing... well, the way they ask it... I was just sitting there for the first like 5 minutes of the contest going "wtf? am I high? how come I'm not getting the first question??"

solution is simple though - just check if all 3 words have the same first or last letter Laughing

Author:  Chimaera [ Tue Feb 24, 2004 10:08 pm ]
Post subject: 

w/e dodge, how is it NOT lattice points? It was a 3d system where there was an x, y, z coordinates. Explain yourself when you say that, instead of just saying that I'm wrong.

ps. ty tony for clearing S1 for me, I would never have thought of it that way, props for figuring it out. In terms of difficulty, I'd probably have to say S5 was the toughest one of them all, but to each his own.

Author:  AsianSensation [ Tue Feb 24, 2004 11:15 pm ]
Post subject: 

actually dodge, I finished J1 - 4 in 7 minutes, lol, mis-reported my time by 3 whole minutes.

anyways, I was trying forever for J5, took me at least 30 something minutes to understand what it's asking for. Then I was like, hey wouldn't this be fun if I used whatdotcolor? Of course, I sat next to dodge, so he was like Do it! Do it! So I tried with whatdotcolor, except abstract whatdotcolor, I made my own drawfill functions, abstract whatdotcolor functions and everything. As you could see, it didn't work.So then I went back and started over. So there is still 2 hours something left, I forgot about the orientation of the boxes and stuff, so I went back and did that. took some time, blah blah blah, brain got jumbled up, starts to hardcode with 1 hour left. Should have just hardcoded it from the beginning.

Author:  Brightguy [ Tue Feb 24, 2004 11:33 pm ]
Post subject:  Re: so how did you guys do on this years CCC?

tony wrote:
solution is simple though - just check if all 3 words have the same first or last letter Laughing

Tony, I'm not sure I understand this - is it really that easy? You're saying that if all three words have the same first or last letter, then the collection of words is not fix-free (i.e. one word is the prefix/suffix of another word)?

But even if both the first and last letters of all three words are the same, that doesn't necessarily mean that one word is the prefix/suffix of another word. For example, take the collection of words:

aba
abba
abbba

Each word has the same first and last letter, but no word is the prefix/suffix of another word. Thus, the collection of words is fix-free.

Author:  nate [ Tue Feb 24, 2004 11:34 pm ]
Post subject: 

For the J5 question it was a bitch i had over 1.5 hours remaining and i spent most of that time understanding it like Asn_S. I still don't really understand this part

code:



*********
*********
*********
*********
*********
*********
*********
*********
*********

turns to

              ***
              ***
              ***
           *********
           *********
           *********
        ***************
        ***************
        ***************
     ***   *********   ***
     ***   *********   ***
     ***   *********   ***  <- I don't understand how theses end parts came to be.  on either side.

Could someone explain try to explain this?

Thanks

Author:  Tony [ Tue Feb 24, 2004 11:49 pm ]
Post subject: 

Brightguy - the question says that a part of the word can be made into prefix/suffix... such as for word "cat", "c", "ca" and "cat" are different prefixes... notice that all 3 prefexis have the same first letter "c"... that's what you're checking for.

in your example all 3 words have a common prefix(and suffix in this case) of "a"

Author:  Brightguy [ Wed Feb 25, 2004 12:06 am ]
Post subject:  Re: so how did you guys do on this years CCC?

A collection of words is prefix-free if no word is a prefix of any other word.

In my example:
-Prefixes of the first word: "aba", "ab", "a".
-Prefixes of the second word: "abba", "abb", "ab", "a".
-Prefixes of the last word would be: "abbba", "abbb", "abb", "ab", "a".

Yes, some of the prefixes of the words are the same, but the question is asking if a word in the collection is a prefix of another word. Not if the prefixes of two words are the same. In my example above none of the prefixes are the same as another word in the collection.

Author:  Tony [ Wed Feb 25, 2004 12:47 am ]
Post subject: 

Quote:

word

ohhh Surprised don't I feel like an idiot now Rolling Eyes Rereading the question again after being told repeatedly that I'm doing the wrong thing helps... Confused

their "cat" = "c", "ca", "cat" example threw me off Rolling Eyes

solution is still simple though, you just pick a word of the least length and check if other two begin with it.
code:

if smallword = word2(1..length(smallword)) and smallword - word3(1..length(smallword)) then

result "word is not prefix free"
end if


same way for the suffix part Rolling Eyes

Author:  TheZsterBunny [ Wed Feb 25, 2004 5:17 am ]
Post subject:  In response to nate.

Please forgive the crude animation, it is 1/4 past 5 in the morn.

This is what question j5 is asking for, i think. I've colour coded the parts of the square which get reflected. green is diagonal and dark blue is horizontal/vertical.


if a further explanation is needed, msg me.

-bunny

-----

(reflections from the 1/3-2/3 point in the shape)

Author:  zylum [ Wed Feb 25, 2004 5:15 pm ]
Post subject: 

damn, i screwed up for S3... i did think that they would assign values to the cells by referencing upcoming cells that dont have a value yet but will if you finish the loop... DAMN!!! anyways if you want a working answer to the spread sheet, here's an updated version of mine which... damn, an extra 5 lines would have given me perfect on S3!!! im so dumb

code:

var file : int
var fileName : string := "s3.4.data"
open : file, fileName, get
var cellValue : array 1 .. 10, 1 .. 9 of string
for i : 1 .. 10
    for j : 1 .. 9
        cellValue (i, j) := "-1"
    end for
end for

var location : array 1 .. 10, 1 .. 9 of string
var value : int
var addValue : int

for a : 1 .. 90
    for row : 1 .. 10
        for col : 1 .. 9
            if a = 1 then
                get : file, location (row, col)
            end if
            if strintok (location (row, col)) then
                cellValue (row, col) := location (row, col)
            else
                value := 0
                addValue := 1
                for i : 1 .. length (location (row, col)) by 3
                    if strint (cellValue ((ord (location (row, col) (i)) - 64), strint (location (row, col) (i + 1)))) > -1 then
                        if addValue = 1 then
                            value += strint (cellValue ((ord (location (row, col) (i)) - 64), strint (location (row, col) (i + 1))))
                        end if
                    else
                        addValue := 0
                    end if
                end for
                if addValue = 1 then
                    cellValue (row, col) := intstr (value)
                end if
            end if
        end for
    end for
end for

cls
for i : 1 .. 10
    for j : 1 .. 9
        if j < 9 then
            if strint (cellValue (i, j)) < 0 then
                put "* " ..
            else
                put cellValue (i, j), " " ..
            end if
        else
            if strint (cellValue (i, j)) < 0 then
                put "*"
            else
                put cellValue (i, j)
            end if
        end if
    end for
end for


-zylum

Author:  zylum [ Wed Feb 25, 2004 5:22 pm ]
Post subject: 

here's my answer to S1... was pretty simple:

code:

var file : int
var fileName : string := "s1.5.data"
open : file, fileName, get
var samples : int
get : file, samples

var collec : array 1 .. samples, 1 .. 3 of string
var fix : array 1 .. samples of int

for i : 1 .. samples
    for j : 1 .. 3
        get : file, collec (i, j)
    end for
end for

for i : 1 .. samples
    fix (i) := 1
    for j : 1 .. 3
        for k : 1 .. 3
            if j not= k then
                if length (collec (i, j)) <= length (collec (i, k)) then
                    if collec (i, j) = collec (i, k) (1 .. length (collec (i, j))) then
                        fix (i) := 0
                    end if
                    if collec (i, j) = collec (i, k) (* - (length (collec (i, j))) + 1 .. *) then
                        fix (i) := 0
                    end if
                end if
            end if
        end for
    end for
    if fix (i) = 1 then
        put "yes"
    else
        put "no"
    end if
end for


btw, i used keyboard input for all my answers but for your convenience, i altered them to work with data files...

Author:  zylum [ Wed Feb 25, 2004 5:28 pm ]
Post subject: 

man, i also screwed up on S2... it works as long as there isnt any ties... damn... i added an extra 3 lines to my original solution and now it works properly... damn those stupid mistakes will cost me big time...

code:

var file : int
var fileName : string := "s2.5.data"
open : file, fileName, get
var yodlers : int
var rounds : int
get : file, yodlers
get : file, rounds

var score : array 1 .. yodlers of int
for i : 1 .. yodlers
    score (i) := 0
end for
var rank : array 1 .. yodlers of int
var tempScore : int

var rankCount : int := 0

for R : 1 .. rounds
    for i : 1 .. yodlers
        get : file, tempScore
        score (i) += tempScore
    end for

    for i : 1 .. yodlers
        rankCount := 0
        for j : 1 .. yodlers
            if i not= j then
                if score (j) > score (i) then
                    rankCount += 1
                end if
            end if
        end for
        if R = 1 then
            rank (i) := rankCount + 1
        else
            if rank (i) < rankCount + 1 then
                rank (i) := rankCount + 1
            end if
        end if
    end for
end for

var winner : int := 1

for i : 2 .. yodlers
    if score (i) > score (winner) then
        winner := i
    end if
end for

cls
for i : 1 .. yodlers
    if score (i) = score (winner) then
        put "Yodler ", i, " is the top Yodeller: score ", score (i), ", worst rank ", rank (i)
    end if
end for

Author:  TheZsterBunny [ Wed Feb 25, 2004 6:02 pm ]
Post subject: 

Don't kill yourselves over 3 or 5 lines. Understandably, this is frustrating, but you may only lose one point over it.

The Junior questions were very simple, with the exception of question number 5. This required recursion, a topic with which most grade 10 or 11's are unfamiliar with.

If anyone has a working solution for J5, I'm sure that many people would want to see it. (+Bits)

I hate bribes, but sometimes...

-bunny

Author:  nelson [ Wed Feb 25, 2004 6:03 pm ]
Post subject: 

hello, this is wut i did for s2
i not gonna show u how i fucked up the worst rank,,,

code:

var n, k : int

put "Enter number of contestents: "
get n
put "Enter the number of rounds: "
get k


var input : array 1 .. k, 1 .. n of int


for i : 1 .. k
    put "input scores for round ", i
    for j : 1 .. n
        get input (i, j)
    end for
end for

var score : array 1 .. n of int
var con : array 1 .. n of int

for i : 1 .. n
    score (i) := 0
    con (i) := i
end for


var rank : array 1 .. n of int

for i : 1 .. k
    for j : 1 .. n
        score (j) := score (j) + input (i, j)
    end for
end for

var temp1, temp2, temp3, temp4 : int

for i : 1 .. n - 1
    for j : i + 1 .. n
        if score (j) > score (i) then
            temp1 := score (i)
            score (i) := score (j)
            score (j) := temp1

            temp2 := con (i)
            con (i) := con (j)
            con (j) := temp2
        end if
    end for
end for

var c : int := 1
var high : int




high := score (1)



for i : 2 .. n
    if score (1) = score (i) then
        c := c + 1
    end if
end for



for i : 1 .. c - 1
    for j : i + 1 .. c
        if con (j) < con (i) then
            temp2 := con (i)
            con (i) := con (j)
            con (j) := temp2
            temp1 := score (i)
            score (i) := score (j)
            score (j) := temp1
        end if
    end for
end for


var l : int
l := n




????????????????
??????????????
?????????????????                worst rank conding,,,, stupidity
???????????????
????????????






put " "
if n < 2 then
    put "YODELLR ", con (1), " is the Top Yodeller: score ", score (1)

else
    for i : 1 .. c
        put "YODELLR ", con (i), " is the Top Yodeller: score ", score (i), " worst rank ", l + 1
    end for
end if

Author:  nelson [ Wed Feb 25, 2004 6:04 pm ]
Post subject: 

and s3,

can someone comment on this plz? ,,, other than datafile..



code:

var spread : array 1 .. 10, 1 .. 9 of string
var ok : int
var num : array 1 .. 10, 1 .. 9 of string

var temp, temp2 : int
var oricol, orirow : int



for i : 1 .. 10
    for j : 1 .. 9
        num (i, j) := "*"
    end for
end for


put "INPUT A ROW"
for i : 1 .. 9
    get spread (1, i)
end for
put "INPUT B ROW"
for i : 1 .. 9
    get spread (2, i)
end for
put "INPUT C ROW"
for i : 1 .. 9
    get spread (3, i)
end for
put "INPUT D ROW"
for i : 1 .. 9
    get spread (4, i)
end for
put "INPUT E ROW"
for i : 1 .. 9
    get spread (5, i)
end for
put "INPUT F ROW"
for i : 1 .. 9
    get spread (6, i)
end for
put "INPUT G ROW"
for i : 1 .. 9
    get spread (7, i)
end for
put "INPUT H ROW"
for i : 1 .. 9
    get spread (8, i)
end for
put "INPUT I ROW"
for i : 1 .. 9
    get spread (9, i)
end for
put "INPUT J ROW"
for i : 1 .. 9
    get spread (10, i)
end for






var row : string
var rowint : int
var col : int
var temppp : int

proc switch2

    if row = "A" then
        rowint := 1
    end if
    if row = "B" then
        rowint := 2
    end if

    if row = "C" then
        rowint := 3
    end if

    if row = "D" then
        rowint := 4
    end if
    if row = "E" then
        rowint := 5
    end if

    if row = "F" then
        rowint := 6
    end if

    if row = "G" then
        rowint := 7
    end if

    if row = "H" then
        rowint := 8
    end if
    if row = "I" then
        rowint := 9
    end if
    if row = "J" then
        rowint := 10
    end if

    if num (rowint, col) = "*" then

    else
        if num (orirow, oricol) = "*" then
            num (orirow, oricol) := "0"
        end if

        temppp := strint (num (rowint, col)) + strint (num (orirow, oricol))
        num (orirow, oricol) := intstr (temppp)
        ok := 2
    end if

end switch2



proc switch
    if row = "A" then
        rowint := 1
    end if
    if row = "B" then
        rowint := 2
    end if

    if row = "C" then
        rowint := 3
    end if

    if row = "D" then
        rowint := 4
    end if
    if row = "E" then
        rowint := 5
    end if

    if row = "F" then
        rowint := 6
    end if

    if row = "G" then
        rowint := 7
    end if

    if row = "H" then
        rowint := 8
    end if
    if row = "I" then
        rowint := 9
    end if
    if row = "J" then
        rowint := 10
    end if

    if num (rowint, col) = "*" then
    else

        num (orirow, oricol) := num (rowint, col)

    end if


end switch



var tempr : string
% for pp : 1 .. 1000
ok := 1
for i : 1 .. 10
    for j : 1 .. 9
        if strintok (spread (i, j)) then
            num (i, j) := spread (i, j)

        elsif length (spread (i, j)) = 2 then
            tempr := num (i, j)
            row := spread (i, j) (1)
            col := strint (spread (i, j) (2))
            orirow := i
            oricol := j
            switch
            % if tempr = num (i, j) then
            %     ok := 2
            % end if
        else
            temp := 1
            tempr := num (i, j)
            for o : 1 .. floor (((length (spread (i, j))) - 1) / 2)
                temp2 := temp + 1
                row := spread (i, j) (temp)

                col := strint (spread (i, j) (temp2))
                orirow := i
                oricol := j
                switch2

                temp := temp + 3
            end for
        end if

    end for
end for



loop
    ok := 1
    for i : 1 .. 10
        for j : 1 .. 9

            if spread (i, j) = "*" then
                if strintok (spread (i, j)) then
                    num (i, j) := spread (i, j)

                elsif length (spread (i, j)) = 2 then
                    tempr := num (i, j)
                    row := spread (i, j) (1)
                    col := strint (spread (i, j) (2))
                    orirow := i
                    oricol := j
                    switch
                    if tempr = num (i, j) then
                    else
                        ok := 2
                    end if
                else
                    temp := 1
                    tempr := num (i, j)
                    for o : 1 .. floor (((length (spread (i, j))) - 1) / 2)
                        temp2 := temp + 1
                        row := spread (i, j) (temp)

                        col := strint (spread (i, j) (temp2))
                        orirow := i
                        oricol := j
                        switch2
                        if tempr = num (i, j) then
                        else
                            ok := 2
                        end if
                        temp := temp + 3
                    end for
                end if
            end if
        end for
    end for
    if ok = 1 then
        exit
    end if
end loop



for i : 1 .. 10
    for j : 1 .. 9
        put num (i, j), " " ..
    end for
    put " "
end for



Author:  bugzpodder [ Wed Feb 25, 2004 6:11 pm ]
Post subject: 

J5 wow dam they made it THAT hard that Asian_S cant even do?? I gotta see this one
S4 is definately NOT trivial... first of all, i think the ship has orientation, that means if you turn, the directions changes. secondly its not latice points... you are suppose to find the equation of a line that passes thrugh the planet that is perpendicular to the path travelled and check if the intersection is on the segment (path travelled). if it is, find the distance, otherwise take the shorter distance of the end points. it requires some consider amount of 3D algebra (taught in grade 12)

I will post my solutions to the seniors (in C++) if anyone's interested, when i get access to them... well the ones besides S4 which i am too lazy to code up. ps they have a new marking scheme for partial marks so i might make stage 2 this year Very Happy

Author:  Dan [ Wed Feb 25, 2004 9:00 pm ]
Post subject: 

i did the s level of the ccc this year. i was very disapointed in them. there questions made no logical sencen and cause me to do the question wrong. also i spent so much time trying to figger out what they are saying i did not even get to S4 and S5. now that i know what they ment i am reay pissed b/c it whould have not been that hard to do. oh well....

Author:  Asok [ Wed Feb 25, 2004 11:37 pm ]
Post subject: 

I agree with Dan, they really tried to hide what they wanted the program to do.

Author:  bugzpodder [ Thu Feb 26, 2004 7:48 am ]
Post subject: 

In all fairness, i would say that S1, S2, S3, S5 are very straight-foward (in terms of clarity of the problem statement), and S4 is pretty clear (of course, once you figure out whats going on -- with the sample test case as a hint) and very cleverly composed.

Author:  Andy [ Thu Feb 26, 2004 10:56 am ]
Post subject: 

nelson, ever heard of index?

Author:  SilverSprite [ Thu Feb 26, 2004 12:06 pm ]
Post subject: 

i think that s4 was not AS hard as bugz makes it out to be.. though still pretty tough

the orientation is not hard. create a variable for each of the 3 axis and corresponding booleans. when you turn you just change the front of yoru ship to the side your turning to, and you logically invert the side your turning to. the third axis remains the same.

as for the shortest distance. that is a little tougher. but doing it by hand would not be so hard if your knowledgable in algebra. which you should all be, if you do 3d programming.

the problem was not poorly worded, however, it was not easy to figure out that you needed to find teh shortest distance to the line.

Author:  zylum [ Thu Feb 26, 2004 1:02 pm ]
Post subject: 

for anyone who is interested, here is the answer to S4....

code:

var file : int
var fileName : string := "s4.3.data"
open : file, fileName, get
var orient : array 1 .. 3 of int := init (1, 2, 3)
var coords : array - 3 .. 3 of int
var dist : real := 100000

var move : int
var dir : string
var tempDir : int

for i : -3 .. 3
    coords (i) := 0
end for

var tempCoords : int
for i : 1 .. 3
    get : file, tempCoords
    if tempCoords < 0 then
        coords (-i) := tempCoords
    else
        coords (i) := tempCoords
    end if
end for
var pDist : array 1 .. 3 of real
for i : 1 .. 3
    get : file, pDist (i)
end for
dir := "L"
var xd : real
var yd : real
var zd : real
var tempDist : real
loop
    exit when dir = "E"
    get : file, move
    get : file, dir
    for : 1 .. move
        coords (orient (1)) += 1
        for i : 1 .. 3
            coords (i) -= coords (-i)
        end for
        xd := pDist (1) - coords (1)
        yd := pDist (2) - coords (2)
        zd := pDist (3) - coords (3)
        tempDist := sqrt (abs (xd ** 2 + yd ** 2))
        tempDist := sqrt (abs (tempDist ** 2 + zd ** 2))
        if tempDist < dist then
            dist := tempDist
        end if
    end for
    if dir = "L" then
        tempDir := orient (2)
        orient (2) := -orient (1)
        orient (1) := tempDir
    end if
    if dir = "R" then
        tempDir := -orient (2)
        orient (2) := orient (1)
        orient (1) := tempDir
    end if
    if dir = "U" then
        tempDir := orient (3)
        orient (3) := -orient (1)
        orient (1) := tempDir
    end if
    if dir = "D" then
        tempDir := -orient (3)
        orient (3) := orient (1)
        orient (1) := tempDir
    end if
end loop

put dist : 0 : 2



-zylum

Author:  shorthair [ Thu Feb 26, 2004 3:39 pm ]
Post subject: 

Wow i went way to complex , i was no where near that , Gosh i think way to hard about these problems , Nice code by the way , i understand that more than i understand the question Very Happy

Author:  bugzpodder [ Thu Feb 26, 2004 4:24 pm ]
Post subject: 

when its the shortest, it doesnt have to be integer coordinates

Author:  zylum [ Thu Feb 26, 2004 4:26 pm ]
Post subject: 

what do you mean bugz???

Author:  amvbse [ Thu Feb 26, 2004 4:52 pm ]
Post subject: 

The solution for S4 only works for the first 2 data inputs. Input 3, and 5 are relatively close, and 4 is off. Still a very nice job.

Author:  zylum [ Thu Feb 26, 2004 5:01 pm ]
Post subject: 

damn... i tested it on the first 2 and didnt think to test on the others... sorry for posting a faulty program...

Author:  azndragon [ Thu Feb 26, 2004 5:03 pm ]
Post subject: 

This topic is very depressing for me. I always did good in Computer Science, and I considered myself to be pretty good. However, our teacher did not adequately prepare us, and the best programmer in our school only managed to finish 3 questions, while I finished 2. I need to work on my logic more Sad

Author:  zylum [ Thu Feb 26, 2004 5:19 pm ]
Post subject: 

i still dont see why my program doesnt work... can someone plz explain where it goes wrong?? (S4)

-zylum

Author:  nis [ Thu Feb 26, 2004 5:20 pm ]
Post subject: 

I did the senior contest and answered 1 2 3 and 4. for 5 i ran out of time and jsut ended up getting how ever many inputs were needed for the sample input and just putting to the screen the answer to the sample out put. hopfully i will get a couple marks for that.

Author:  limited_skillz [ Thu Feb 26, 2004 6:11 pm ]
Post subject: 

did anyone finish j5?

ive been losing sleep over it Sad, im takin gr 12 (im in 11) and i know recursion in and out, but i really dont understand how to do it

Author:  bugzpodder [ Thu Feb 26, 2004 7:26 pm ]
Post subject: 

zylum wrote:
i still dont see why my program doesnt work... can someone plz explain where it goes wrong?? (S4)

-zylum


you assumed the shortest distance is going to lie on a lattice point. not necessarily true. actually i think a nice way to approach this is that for segment AB, check A', B', two points that are really close to A, B. if distance is strictly decreasing/increasing then you could just take the shorter distance at A or B. otherwise just use the point to a line distance formula which is CA X AB / |AB|
of course the orientations much be maintained also

Author:  bugzpodder [ Thu Feb 26, 2004 7:28 pm ]
Post subject: 

azndragon wrote:
This topic is very depressing for me. I always did good in Computer Science, and I considered myself to be pretty good. However, our teacher did not adequately prepare us, and the best programmer in our school only managed to finish 3 questions, while I finished 2. I need to work on my logic more Sad


you arent the only one who are depressed... but generally speaking everyone did pretty badly Wink

Author:  Tony [ Thu Feb 26, 2004 8:39 pm ]
Post subject: 

limited_skillz wrote:
did anyone finish j5?

im takin gr 12 (im in 11)


what's going on? Confused I though junior contest had a restriction that allows you to write it just once and only if you have no more then 1 CS credit Confused ... Thinking

Author:  gvc [ Thu Feb 26, 2004 8:45 pm ]
Post subject: 

bugzpodder wrote:
zylum wrote:
i still dont see why my program doesnt work... can someone plz explain where it goes wrong?? (S4)

-zylum


you assumed the shortest distance is going to lie on a lattice point. not necessarily true. actually i think a nice way to approach this is that for segment AB, check A', B', two points that are really close to A, B. if distance is strictly decreasing/increasing then you could just take the shorter distance at A or B. otherwise just use the point to a line distance formula which is CA X AB / |AB|
of course the orientations much be maintained also


Bugs,

This is one of the unfortunate cases in which you were disadvantaged by thinking too much. Because the planet is on a grid location, and the turtle travels from grid location to grid location on straight lines, the closest point will always be when the turtle is at a grid location. So all you have to do is move one unit at a time and check the distance after each move.

If the planet were located at an arbitrary place, or if the turtle could travel on the diagonal, you would have to do the geometry you suggest.

Author:  Andy [ Thu Feb 26, 2004 9:28 pm ]
Post subject: 

ya see he didnt take gr 10

Author:  Brightguy [ Thu Feb 26, 2004 9:41 pm ]
Post subject:  Re: so how did you guys do on this years CCC?

tony wrote:
what's going on? Confused I though junior contest had a restriction that allows you to write it just once and only if you have no more then 1 CS credit Confused ... Thinking

My computer science teacher gave us both the junior and senior booklets and told us we could do either; he didn't mention any restrictions.

Apparently I slightly misunderstood S2. When it said to output the worst rank, I thought it meant the rank of the worst yodeller, not the winner's worst rank. Sad In the sample case when they explained the output they listed everyone's current rank, not their worst rank. And it just so happened that the winner's worst rank overall was the same as the loser's final rank. Rolling Eyes

So I lost 4 marks on that question. And in S3, my program took too long to run on the last two test cases. (And I had commented a line which would have allowed the program to run in time for the last test case! Mad )

So I got 15/15 in S1, 11/15 in S2, and 9/15 in S3, for a total of 35. I guess that's alright, but I know I could've done better. But I bet a lot of people are thinking that right now...
Overall I enjoyed it. Smile

Author:  Tony [ Thu Feb 26, 2004 11:32 pm ]
Post subject: 

lol Laughing Well before they used to have those J3/S1, J4/S2, J5/S3 questions... where you basically do the common 3 and deside if you wanna pretend to be a junior and go for the highscore with first two easy questions, or play with the rest on the "senior" playfield... this year apparently it was not the case Rolling Eyes no common questions Confused

Author:  amvbse [ Thu Feb 26, 2004 11:34 pm ]
Post subject: 

azndragon wrote:
This topic is very depressing for me. I always did good in Computer Science, and I considered myself to be pretty good. However, our teacher did not adequately prepare us, and the best programmer in our school only managed to finish 3 questions, while I finished 2. I need to work on my logic more Sad


I know exactly what you mean. We weren't even taught recursion in gr12 (finished it 1st semester) by our teacher who I doubt even knows what it is. I definetaly need to hang around here more and pick up on things.

Author:  bugzpodder [ Fri Feb 27, 2004 7:38 am ]
Post subject: 

tony wrote:
limited_skillz wrote:
did anyone finish j5?

im takin gr 12 (im in 11)


what's going on? Confused I though junior contest had a restriction that allows you to write it just once and only if you have no more then 1 CS credit Confused ... Thinking


i guess i should have taken the junior Embarassed

Author:  bugzpodder [ Fri Feb 27, 2004 7:43 am ]
Post subject: 

gvc wrote:
bugzpodder wrote:
zylum wrote:
i still dont see why my program doesnt work... can someone plz explain where it goes wrong?? (S4)

-zylum


you assumed the shortest distance is going to lie on a lattice point. not necessarily true. actually i think a nice way to approach this is that for segment AB, check A', B', two points that are really close to A, B. if distance is strictly decreasing/increasing then you could just take the shorter distance at A or B. otherwise just use the point to a line distance formula which is CA X AB / |AB|
of course the orientations much be maintained also


Bugs,

This is one of the unfortunate cases in which you were disadvantaged by thinking too much. Because the planet is on a grid location, and the turtle travels from grid location to grid location on straight lines, the closest point will always be when the turtle is at a grid location. So all you have to do is move one unit at a time and check the distance after each move.

If the planet were located at an arbitrary place, or if the turtle could travel on the diagonal, you would have to do the geometry you suggest.


yeah you are right... i withdraw my previous comments... new to compsci.ca?? you would be??

Author:  zylum [ Fri Feb 27, 2004 12:55 pm ]
Post subject: 

well of course if the planet is located on integers and you only move onto integers, the closest point will be an integer... so whats wrong with my program??

Author:  bugzpodder [ Fri Feb 27, 2004 3:49 pm ]
Post subject: 

zylum wrote:
well of course if the planet is located on integers and you only move onto integers, the closest point will be an integer... so whats wrong with my program??


then probably your orientation then

Author:  zylum [ Fri Feb 27, 2004 4:18 pm ]
Post subject: 

well then why does it work for the first 2 and not the others? hmm... i checked my orientation and i cant seem to find any mistakes...

Author:  zylum [ Fri Feb 27, 2004 4:22 pm ]
Post subject: 

bugzpodder wrote:
tony wrote:
limited_skillz wrote:
did anyone finish j5?

im takin gr 12 (im in 11)


what's going on? Confused I though junior contest had a restriction that allows you to write it just once and only if you have no more then 1 CS credit Confused ... Thinking


i guess i should have taken the junior Embarassed


lol, i should have taken junior too!!! (i only have 1 credit of compsci) it would have been sooo much easier lol... well atleast i would have gotten a better score than i did on the senior... i made some pretty stupid mistakes on the senior one Sad

btw, can someone plz post the J5 question??? i want to see if its as difficult as everyone says it is

Author:  Touya-kun [ Fri Mar 12, 2004 5:31 pm ]
Post subject: 

I'm in Grade 10 (but taking grade 11 comp sci), and I got 59. Scarily enough, that's actually the third-highest mark in the school. I didn't get J5, and for some reason, on the J4 question, one of my outputs came out a character too short. All the other outputs worked fine--but this one was missing an "I" at the end. I still have no clue why. Rolling Eyes

Ah well, there's always next year Very Happy

Author:  TheZsterBunny [ Mon Mar 15, 2004 9:20 am ]
Post subject: 

Same. I finished with 59 in the junior, and lost one mark one the first question.

"The square has a side length of: #", I put.

Needed "The square has side length of: #"

one letter...

-bunny

Author:  bevoyleick [ Tue Mar 16, 2004 7:36 pm ]
Post subject: 

it was SO crappy, the judges suxxor!!! they told us not to put extentions to our code in our "read-file" command, so we only put "data11" for the filename, but then we got a comment from the judges that said "Garbage, crashed". How the hell are we supposed to read files in Turing without adding extensions??

Author:  AsianSensation [ Tue Mar 16, 2004 7:50 pm ]
Post subject: 

umm..easy?

code:
var filein : int
open : filein, "data11", get


no extension is required for input and output to files.

Author:  bevoyleick [ Wed Mar 17, 2004 9:54 am ]
Post subject: 

what?? does it even work? how does turing know how to read the file if it doesn't have the extensions??

Author:  Tony [ Wed Mar 17, 2004 11:19 am ]
Post subject: 

bevoyleick wrote:
what?? does it even work? how does turing know how to read the file if it doesn't have the extensions??

Laughing it reads its ASCII or binary depending on how you open the file. Just cuz the extension says its a photoshop file, turing will not become a drawing program if you open that file Laughing

Author:  bevoyleick [ Fri Mar 19, 2004 6:54 pm ]
Post subject: 

why did the program run fine when we added ".txt" to the read file command then?

Author:  AsianSensation [ Fri Mar 19, 2004 7:31 pm ]
Post subject: 

maybe when you declared it in turing, you had .txt?

code:
open : filein, "data11", get


and

code:
open : filein, "data11.txt", get


are two different things

Author:  bevoyleick [ Sat Mar 20, 2004 12:03 pm ]
Post subject: 

no, in all our read file commands, the filename is saved as a string, so we only had to change the value of the string at the start of the program and it'll apply to the rest. and we did put "data11" as the string value.

Author:  AsianSensation [ Sat Mar 20, 2004 6:32 pm ]
Post subject: 

well, the file itself might be named "data11.txt". Unless I see the actual code and know what happened there, I really can't tell you exactly what. But I am very certain that you can input and output to files without extensions, I should know, done it countless times at the DWITE competitions.

Author:  the_short1 [ Wed Mar 24, 2004 10:17 pm ]
Post subject: 

whens the next contest i mite want to enter.....
'*** a teacher suggested after seeing my pacman, text twist, and download manager

Author:  bugzpodder [ Thu Mar 25, 2004 6:59 am ]
Post subject: 

i've entered the contest enough times but i've never figured out how to do pacman or any other sort of graphics stuff. Sad

Author:  TheZsterBunny [ Thu Mar 25, 2004 7:28 am ]
Post subject: 

short 1, before you say anything, remember that bugz does not use turing for his programs. I don't know if you do or not (not a huge pac-man fan), but before you start typing out hundreds of lines of message, remember: They do not use turing.

Author:  the_short1 [ Thu Mar 25, 2004 6:18 pm ]
Post subject: 

they dont use turing for the cobntest for junior....hmmm... any contests for turing???? i will have to learn c++ over summer....

hmm... zester.... u should try my game even if ur not a fan... Razz its 8)
bugz pac man for me... took 3000 Lines... so ... yea...
OMFG!!!!! i just though of how to reduce like 300 LIENS of code... SWEET!

if Input.KeyDown (Control) (chr for down)

if whatdotcolor (pacmx,pacxy-25) = wallcol then
move := 0 << NO basically...

then do that for each direction and VOILA.... rite now i have it fo =r every wall chunk

if pacmy +25 = wallcord(125,33)
if pacmy +25 = wallcord (100,33)
HELL YA... i love wahtdotcolor i wish i though of that earlier... damit!!!!!
i can make walls for enemy too... damit...sooo DAM fricking EZ! stupid fricking me.... only hard part bout enemywalls is an enemy would get stuck against a wall if u were on other side....

srry for spaming... but... DAM! just came to me... had to write it out

Author:  TheZsterBunny [ Mon May 24, 2004 6:05 pm ]
Post subject: 

Sorry for bringing up an old topic, but here:

[url]
http://www.google.ca/search?q=cache:-SJNQ_wwIpUJ:www.cmc.uwaterloo.ca/ccc/2004/stage1/2004.result.pdf+Canadian+Computing+Competition+scores&hl=en&lr=lang_en[/url]

we have our results.

-Z

Author:  Paul [ Mon May 24, 2004 6:14 pm ]
Post subject: 

hm... I think both dodge and Asian sensation are on there. And then there's jeffry liu, I forgot his compsci name lol.

Author:  bugzpodder [ Mon May 24, 2004 8:05 pm ]
Post subject: 

me=11th in canada, same as last year
i believe dodge'll give me some bits 8)

Author:  TheZsterBunny [ Mon May 24, 2004 8:14 pm ]
Post subject: 

beh. tied at 100th

that one point...

-Z

Author:  AsianSensation [ Mon May 24, 2004 8:17 pm ]
Post subject: 

yeah, if you got 60 on junior, it's like 30 something position, if you got 59, it's like 100 something...ouch

btw, bugz, good job, plus bits.

Author:  Tony [ Mon May 24, 2004 9:49 pm ]
Post subject: 

i dont even know what my score is... my teacher wouldn't tell me... but I've got a good feeling I'm not in top 25% Rolling Eyes w/e, I just need to try to get my certificated from last year's contest Confused yeah, my teacher still didn't give that to me Shocked

Author:  AsianSensation [ Mon May 24, 2004 9:54 pm ]
Post subject: 

I remember waterloo gave us a bunch of blank contest certificates, cuz alot of people wrote the contest, and we were to print names on them.

Needless to say, "Jesus", and "George W. Bush" all ended up in the top 25%

Laughing

Author:  Danyo [ Mon May 24, 2004 10:23 pm ]
Post subject: 

i got 9th in this years Juniors, with 66 (just making it Very Happy)

i finished the first 4 in a about half an hour... and then i just STARED at the last one... i honestly had no clue what they were talking about
about 10 minutes left and i just rambled on

those fractals made no sense.. did anyone get it?

Author:  the_short1 [ Tue May 25, 2004 6:54 am ]
Post subject: 

i wish i knew what fractals were / how to make them... they look SO DAM SWEET!!!!! btw cool number of bits Smile


dam....... i should be getting into contests next year... just have to learn other languages

Author:  bugzpodder [ Tue May 25, 2004 8:02 am ]
Post subject: 

Danyo wrote:
i got 9th in this years Juniors, with 66 (just making it Very Happy)

i finished the first 4 in a about half an hour... and then i just STARED at the last one... i honestly had no clue what they were talking about
about 10 minutes left and i just rambled on

those fractals made no sense.. did anyone get it?


see
http://www.compsci.ca/v2/viewtopic.php?t=3925

Author:  Andy [ Tue May 25, 2004 9:30 am ]
Post subject: 

here bugz, gj on ccc. +110

Author:  thegoose [ Fri Jun 18, 2004 5:22 am ]
Post subject: 

I'm just wondering if anybody here other than Bugz who went to stage 2 for the CCC and what was their score/ranking.

Author:  bugzpodder [ Fri Jun 18, 2004 8:57 pm ]
Post subject: 

i am pretty sure no one here other than me went to stage two

Author:  Brightguy [ Fri Jun 18, 2004 9:59 pm ]
Post subject:  Re: so how did you guys do on this years CCC?

Looks like my score of 35 puts me in a 5-way tie for 52nd in the senior division. Dang... I was 1 mark away from an honourable mention. Rolling Eyes

Good work bugz!!


: