← Back to topics
Topic

X-tra easy

s
s-lime
This week, 5.3.2009, X-tra easy competition will take place. There will be a total of 5 tasks (2 really easy, 2 easy, and one medium).
Because a big tie is expected, time limits are set relatively tight (my solution + 0.2s), so in case time (2 hours) remains to you, I suggest going through code again and making possible optimistaions (so at least replacing cin/cout with scanf/printf).

You are welcome to comment.
T
Tavo92
So, apart from coding fast you have to optimise your code all you can? I don't like the second thing if the algorithm needs a lot of "tiny" optimizations, because I think that's not the point in a programming contest.
s
s-lime
No, no tiny optimisations, just major ones (using scanf when 2mb input). As I said, my solution +0,2s. That's not too bad.
I hope there won't be too big tie, but we'll see.
t
tgudlek
I think that it should be your solution * 2. ( Z-trening policy, correct me if I'm wrong )
g
gates
If tasks are very easy then you can set time limit as your solution time.
s
s-lime
I sortof notified admin, so it seems he's okay with it... And I also don't think there'll be any problem, as algorithm is almost obvious when you see the task.
T
Tavo92
The competition is IOI-like or ACM-like?
g
gates
I think IOI-like.
T
Tavo92
I ask because if it is ACM-like the submition time is an important factor, and as this competition seems to be about how fast, and good!, you can solve a problem set, it can be an ACM-like competition.
g
gates
good idea :)
A
Al3kSaNdaR
It would be nice. =] But I prefer IOI-like competitions. :\
s
s-lime
You guessed right. The competition is IOI like. So this means only one test case is evaluated at competition time, the remaining ones are evaluated afterwards. Correct me if I'm wrong.
A
Amtrix
My only quesion is: "when will be the results ??? " xD, and then the comments are comming....
s
s-lime
I hope soon. But that's really admin's decision.
T
Tavo92
I think you are not used to what "easy" means in z-trening. Your contest, for me, was a bit easier than what we are used to.

Waiting for the results now :D
p
pr0ton
when will results be up. need to go to sleep. 1.30 AM here :D
s
s-lime
I hope admin hurries up, too.
p
pr0ton
good night (or whatever in your timezone :D)
A
Al3kSaNdaR
Admin tell us, when will you post the results ?
T
Tavo92
They are posted, why nobody got 100pt in Periodic Table?
A
Al3kSaNdaR
Error ? I can't get TLE at every case in Magic Four, I have O ( N ) ?!
f
frost_nova
I'm interesting is everything ok with first task?
R
RobertGerbicz
I've already asked, but there was no answer:
for "cas" I think there are two possible answers:
CaS
CAs

That problem is broken.
A
AhmedKamel
s-lime have answered...
He said that there is no such case.
D
Daniel93
My N-Polygon gives the exactly result for the sample test, why I have then all WA ?
n
n.vilcins
But there IS. In the 1st test case s-lime gave us at least there was.
A
AhmedKamel
May be because of handling the output...
you have to print it as %.5lf
o
oa12gb
I don't know how my magic problem got all TLE while I am using KMP search which is really good here ?
o
ortschun
If you calculated the perimeter like cos(x) * (1-r^2), its pretty natural...stupid me..
A
Al3kSaNdaR
Mine too, I used the cosinus theorem and then Pithagora's theorem and I'm positive that I've done it correct, also I can't believe that I get all TLE at Magic - Four, I have just one function call, standard function in Pascal.
f
frost_nova
to Al3kSaNdaR: AFAIK complexity of your solution is O(n*len(s)). It is too slow.
o
oa12gb
and for me in N-polygon I used the cousine function and pythagoras to get the answer and seems too ok but I got only 20 !
A
Al3kSaNdaR
Probably, I don't know what is O ( ) for function Pos. :(

@frost_nova:

Can you take a look at my solution for N-polygon, I believe that it's correct. :\
f
frost_nova
KMP isn't goot for that problem, cos it provides O(len(S)) per query.
o
oa12gb
what do you suggest here ?
f
frost_nova
@Al3kSaNdaR: maybe problem in your PI which is not enough accurate (cos you use sqrt).
A
AhmedKamel
The best way for Magic problem is to store the index of all 4 consecutive char of the long string in an array, then loop on the given short strings and print.

is this the optimal solution ?
f
frost_nova
@oa12gb: using hash provides O(1) per query.
e
eduardische
Even, the author of the "Periodic Table" task got 40 on rhis task) I think something is wrong...
A
Al3kSaNdaR
It has 8 decimals. :S Nevermind I'll wait for tasks to become public and then debug my solutions. :(
n
n.vilcins
Or it is a very tricky problem (:
A
Amtrix
My solution for Magic four is
O( len(STR) + N * log( len(STR) ) )
Maybe cin>> is the reason for TL ....
D
Daniel93
http://www.analyzemath.com/Geometry_calculators/polygon_calculator.html

3.calculator

I have tried it on serveral cases and it allways gives the result, it round up the 5.th decimal.

o
oa12gb
@frost_nova: thanks
R
Ravent
Retest please N-polygon - bad checker.
(check endline symbol)
A
Amtrix
Retest Periodic Table too... My solution outputs the right answer for the first test case 100% :S
A
Al3kSaNdaR
Retest all (:

Good night everyone...
s
s-lime
@Tavo: The periodic table is a big mistery to me also... Don't know what happened. But when I test it under "My tasks", i get 100/100.
@Aleksandar: Magic four requires hashing if you want to get points.
@RobertGerbicz: I have already said it 4 times, there shouldn't be such cases.
@oa12gb and others: You had to use PI up to 10 decimals, and DOUBLE, not FLOAT!

I really don't know what's happening with testing those endlines! They sould be ignored anyway!
s
s-lime
You can view solution and grading if you click on number on result table :P
n
n.vilcins
@s-lime: Unfortunately the discussions during the event are lost (i guess), but there, when you provided with the 1st test case, there WAS a 'CAS' situation (it was not a seperate word but in the middle of another, though the CaS - CAs situation remains). You have the tests, just take a look.
A
Al3kSaNdaR
S-lime, we can't view tasks. :(
a
adminModerator
@s-lime:

I dont know what happened with the periodic table. It's being tested on the same data. I will re-test once just in case.

For the other problems, if you want to update the checkers/tests, I can re-run the tests.

I will make the problems public once the the results are final.
f
frost_nova
hm, seems it isn't difficult to make test on which author's solution on Periodic Table will get TL
S
Sedols
Please Remove z-slime from the top of the table, cuz he is author of this event, so he should be down with other admins.
D
Daniel93
can someone who got 100 points in N-polygons, tell me what is the output for:

24 6.79.. ?
o
oa12gb
@s-lime I used M_PI which is defined in math.h and used doubles isn't that enough ?
D
Daniel93
my Pi looks like this
#define PI 3.14159265
o
oa12gb
s-lime said "You had to use PI up to 10 decimals, and DOUBLE, not FLOAT! " your PI is 8 decimals
D
Daniel93
... does this really matter, cause you could write there up to 100 decimals.
s
s-lime
So, let's get to answer one by one:
@N.vilcinis: Consider the "acas", despite it contains "cas", there is only one solution AcAs. You just have to think. I said there won't be such cases. That a substring contains CAS, it simply doens't matter.
@Daniel93:
42.54110
143.19143
@PI: Yes, I used it 10 decimals or so... But it simply doesn't matter, because the difference is too small, that it wont pass through .5, making the rounding up instead of down. It was more important to use double (16 digit precidion) instead of float (6 digit precision.)
D
Daniel93
@s-lime,
Exactly like my output,,,
s
s-lime
@Daniel93
test1.in:
1644 835

correct1.out:
5246.45654
2190391.60544

your1.out:
5246.45653
2190391.60294

accurate1.out:
5246.456538405149800672398842085090332328066997380350257008729083030981783004096903633824
2190391.605442090282848594342188510627155862126113297682350550151789226612010719846290944

@RobertGerbicz: I'm sorry for your 0/100, but you used cos instead of sin :X
D
Daniel93
I set PI up on 20 decimals and it gives now the correct result, but even if I set on 10 decimals for PI, my code gives WA.....
D
Daniel93
When will be the tasks availlable for solving?
s
s-lime
http://www.z-trening.com/new/www/html/arena.php?competition=8000000038

@Daniel93, i used 16 decimals as double holds 16 places...
#define PI 3.1415926535897932
and I get AC... Sorry, but that's not my fault. The task is asking for 5 accurate decimals (rounded), and you had to calculate so, taking pi as whatever is enough.

Tasks will be available for solving when they are confirmed OK, and I have already said that (now when periodic table have been fixed), so the answer is as soon as admin sees this.
R
RobertGerbicz
Yes, s-lime, after the contest I've observed my silly bug.
n
n.vilcins
@s-lime: Yes, most probably it was the case, I guess. Didn't pay attention to whether the substrings before and after can be obtained individually.
A
AhmedKamel
When will the problems be available ?
s
s-lime
As soon as admin decides so.