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 1100. Final Standings

Strange MLE(#11).
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 26 Jun 2004 19:50
I merged the ID and M arrays. But this actually took more memory than separate ones (Now 1205K, orig. 1093K)

program ural1100;
const
  maxn=149999;
var
  x:array[1..maxn]of longint;
  n,id,i:longint;
  m:byte;
begin
  readln(n);
  for i:=1 to n do begin
    readln(id,m);
    x[i]:=id*101+m;
  end;

  for m:=100 downto 0 do
    for i:=1 to n do
      if x[i] mod 101=m then writeln(x[i] div 101,' ',x[i] mod 101);
end.
I changed readln into read and got MLE(1201K).
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 29 Sep 2004 12:29
And I still have no idea at all why it should get MLE.
I use just about 150000*4=600K memory, and including the basic memory of Pascal which is 357K, I should get AC.
Something strange with default size of stack.
Posted by Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 29 Sep 2004 15:46
I added only one string
{$M 605000,0,0}
and submitted it three times:
706285 15:41:34
29 сен 2004 TECTOBOP 1100 Pascal Accepted
 0.984 953 КБ
706284 15:40:16
29 сен 2004 TECTOBOP 1100 Pascal Accepted
 0.953 953 КБ
706283 15:39:02
29 сен 2004 TECTOBOP 1100 Pascal Time Limit Exceeded 18 1.046 953 КБ
As you see, sometimes it feets in time. It can be optimized using shl/shr instead */div.
Sorry but it doesn't work.
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 29 Sep 2004 20:13
I still get MLE around 1200KB.

BTW, I know little about {$}s. Could you explain more?
Stranger than you think!
Posted by Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 30 Sep 2004 18:04
When maxn=149999 it gets MLE on test 11, when maxn=150000 it gets TLE or AC. If maxn=149999 and there is a directive {$R+} (range checking directive) then you get WA11, as always when there is unknown error (for example, you always get WA1 if do something with external files).
It happens because in test 11 n=150000 (INCORRECT TEST).
First time I looked to the source I've changed maxn to 150000 and forgot about it.

Edited by author 30.09.2004 18:15
Re: Stranger than you think!
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 30 Sep 2004 20:01
If test #11 is incorrect, I think you'd better modify the prob statement.

And after I've changed maxn into 150000, I get TLE at #16. Could you help me with that? I'm using as many shls and shrs as possible.

program ural1100;
const
  maxn=150000;
var
  x:array[1..maxn]of longint;
  n,id,i:longint;
  m:byte;
begin
  read(n);
  for i:=1 to n do begin
    read(id,m);
    x[i]:=id shl 7+m;
  end;

  for m:=100 downto 0 do
    for i:=1 to n do
      if x[i] mod 128=m then writeln(x[i] shr 7,' ',x[i] mod 128);
end.
Ah, it's indeed very easy to make it AC. And I did it, 0.984s.