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 1102. Strange Dialog

Hint for C++ programmers
Posted by HELLER 8 Apr 2002 19:58
I've solved 1102 using DFA and reading 1 char each cycle with
scanf("%c",&c); - and I've got Time Limit
then I've tried c=getc(stdin); - and my program worked for 1.1 second.
May be it will help.
What's DFA , Please discribe it clearly
Posted by XueMao 20 Jul 2002 19:21
Re: Hint for C++ programmers
Posted by Bonny 15 May 2004 23:30
Thanks!! I've got accepted because of your getc() function.
Re: Hint for C++ programmers
Posted by Samsonov Alex 11 Jul 2005 16:29
Yes! I got the same problem - now AC!
No subject
Posted by Spatarel Dan Constantin 4 Oct 2005 02:15
I also thank you ;)
Re: Hint for C++ programmers
Posted by Paul Diac 26 Oct 2005 22:25
Me too ... thanks.
I got time limit with scanf but with getc(stdin) i got accepted in 0.484 sec. Nice problem :D.
Re: Hint for C++ programmers
Posted by div 4 Oct 2006 02:27
Another hint:
if you are using '%' operator in your code, use subtraction instead of it (if you can).
For example, code
  x = (x + 1) % MAX;
got TLE,

whereas
  x++;
  if (x >= MAXL) x -= MAXL;
got AC 0.5
good luck
Re: Hint for C++ programmers
Posted by Slam [Tartu U] 28 Dec 2006 09:16
I still don't understand,,, is first test so large that I could get TLE? Or it's actually some technical problem??