so how did you guys do on this years CCC?
Author |
Message |
Chimaera
|
Posted: Tue Feb 24, 2004 9:54 pm Post subject: (No 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.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Andy
|
Posted: Tue Feb 24, 2004 10:01 pm Post subject: (No subject) |
|
|
wow... s4 is not easy, u dont even understand how the question works... its not lattice points...
|
|
|
|
|
|
Tony
|
Posted: Tue Feb 24, 2004 10:03 pm Post subject: (No subject) |
|
|
StrikerMagazine - the questions did have a new style to them, its not just you
and damn... I should have probably been working on S4 instead of S3
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
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Chimaera
|
Posted: Tue Feb 24, 2004 10:08 pm Post subject: (No 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.
|
|
|
|
|
|
AsianSensation
|
Posted: Tue Feb 24, 2004 11:15 pm Post subject: (No 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.
|
|
|
|
|
|
Brightguy
|
Posted: 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
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.
|
|
|
|
|
|
nate
|
Posted: Tue Feb 24, 2004 11:34 pm Post subject: (No 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
|
|
|
|
|
|
Tony
|
Posted: Tue Feb 24, 2004 11:49 pm Post subject: (No 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"
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Sponsor Sponsor
|
|
|
Brightguy
|
Posted: 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.
|
|
|
|
|
|
Tony
|
|
|
|
|
TheZsterBunny
|
Posted: 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)
|
|
|
|
|
|
zylum
|
Posted: Wed Feb 25, 2004 5:15 pm Post subject: (No 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
|
|
|
|
|
|
zylum
|
Posted: Wed Feb 25, 2004 5:22 pm Post subject: (No 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...
|
|
|
|
|
|
zylum
|
Posted: Wed Feb 25, 2004 5:28 pm Post subject: (No 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
|
|
|
|
|
|
|
TheZsterBunny
|
Posted: Wed Feb 25, 2004 6:02 pm Post subject: (No 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
|
|
|
|
|
|
|
|