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 1590. Bacon’s Cipher

Why N*N TL???
Posted by Furious Wolf 17 Apr 2008 08:14
Help me... I really don't know, why 25000000 TL?
I think 25000000 not many time...and must get AC in 1 sec.

Edited by author 17.04.2008 08:16
Re: Why N*N TL???
Posted by Sandro (USU) 17 Apr 2008 20:45
Try to change the order of FOR cycles. For example,

for (i=0;i<n;i++)
  for (j=0;j<n;j++)
    p[i][j]=1;

works faster than

for (j=0;j<n;j++)
  for (i=0;i<n;i++)
    p[i][j]=1;
Re: Why N*N TL???
Posted by Furious Wolf 18 Apr 2008 09:51
Why???
But I use first variant and get TL...
Re: Why N*N TL???
Posted by Furious Wolf 18 Apr 2008 09:55
25000000 operation : compare of char and value assignment of integer.

And 12500000 operation works 0.953!
Why this work too many time????

Edited by author 18.04.2008 09:58
Re: Why N*N TL???
Posted by Chmel_Tolstiy 18 Apr 2008 23:52
My O(N^2) solution works 0.171.
Re: Why N*N TL???
Posted by Li Wang Ji 19 Apr 2008 01:43
Chmel_Tolstiy wrote 18 April 2008 23:52
My O(N^2) solution works 0.171.
Can you write your code as pseudo or explain your algo in details, please?
Re: Why N*N TL???
Posted by Chmel_Tolstiy 19 Apr 2008 14:23
Not in forum ...
Mail to me. (I send to u my code only)
naxart@yandex.ru
Re: Why N*N TL???
Posted by Nurzhan Dyussenaliyev 20 Jul 2012 21:34
May be because of "mod operation"?