ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1249. Ancient Necropolis

Roma Labish[Lviv NU] Why my program work so slow? [3] // Problem 1249. Ancient Necropolis 26 Jan 2007 14:44
I've only read and check, and don't read whole input.
Why it work's less then 4 sek?
[code deleted]

Edited by author 26.01.2007 17:17
KIRILL(ArcSTU) Re: Why my program work so slow? [1] // Problem 1249. Ancient Necropolis 26 Jan 2007 15:53
Use scanf instead of cin
Input file is very big >10MB

but better use Pascal:)
I don't optimize input at all. It works about 1.3 sec

After simple optimization 0.328 sec

Edited by author 26.01.2007 16:15
Roma Labish[Lviv NU] Re: Why my program work so slow? // Problem 1249. Ancient Necropolis 26 Jan 2007 17:17
Thank you! I've changed cin to scanf and got AC in 1.5 sec ))
FORGOTTEN (Samara STU) Re: Why my program work so slow? // Problem 1249. Ancient Necropolis 20 Nov 2007 20:24
Try to use "gets()" instead "scanf()" and "cin". You can solve it with 2 strings (length = 2*m + 2). I've get AC at 0.156 sec. And some solution are faster.