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

Bourne AC 0.3 Sec 972 KB [11] // Problem 1100. Final Standings 10 Apr 2005 13:49
program Bourne;
  var
    n,i,j,x:longint;
    a:array[0..150000] of smallint;
    b:array[0..150000] of longint;
  begin

    readln(n);
    for i:=1 to n do
      begin
        readln(b[i],a[i]);
      end;

    for x:=100 downto 0 do
      begin
        for i:=1 to n do
          if a[i]=x then writeln(b[i],' ',a[i]);
      end;

  end.
nicushor No subject [1] // Problem 1100. Final Standings 1 Jun 2005 21:55
:) interesting... good done! :)
Re:Your code is wrong!!!!..Memory limite exid

Edited by author 13.05.2006 17:02

Edited by author 13.05.2006 17:02
Cybernetics Team Re: AC 0.3 Sec 972 KB // Problem 1100. Final Standings 2 Jun 2005 20:45
just... brilliant!
acmkx Re: AC 0.3 Sec 972 KB [6] // Problem 1100. Final Standings 24 Nov 2005 13:13
MLE
SSS IT is not AC program, it got MLE [5] // Problem 1100. Final Standings 6 Jan 2006 13:05
Maybe tests were changed since april...
Isnt it, Judges?
void off() Re: IT is not AC program, it got MLE [4] // Problem 1100. Final Standings 6 Jan 2006 20:40
Hmm... It gets MLE, really. Do they count memory on ALL tests, not on every test separately?
Update: I've rewrited it, so it doesn't get MLE:
#include <stdio.h>
void main()
{
  long n;
  unsigned char a[150000];
  unsigned char hi[150000];
  unsigned short lo[150000];
  scanf("%ld",&n);
  for(long i=0;i<n;i++)
  {
    long bod;
    scanf("%ld%d",&bod,&a[i]);
    lo[i]=bod%65536;
    hi[i]=bod/65536;
  }
  for(int v=100;v>=0;v--)
  {
    for(int i=0;i<n;i++)
      if(a[i]==v) printf("%ld %d\n",hi[i]*65536+lo[i],a[i]);
  }
}
How can THIS get WA#11???

Edited by author 06.01.2006 21:12
Dulat_TKTL Re: IT is not AC program, it got MLE [1] // Problem 1100. Final Standings 28 Jan 2006 15:28
I try so
    var
     a: array[0..100,0..150000]of longint;
    o,p,n,j,i : longint;
begin
    readln(n);
  for i:=1 to n do
   begin
   readln(o,p);
   inc(a[p,0]);
   a[p,a[p,0]]:=o;
   end;

  for i:= 100 downto 0 do
   begin
      for j:=1  to a[i,0] do
         writeln(a[i,j],' ',i);
   end;
end.
try to concate K and ID into 1 longint variable (because 10000000=3 bytes, 1 extra) using shl, shr.
I've goten AC and wish you the same

Edited by author 08.02.2006 17:12

Edited by author 08.02.2006 17:12
Michael Rybak (accepted@ukr.net) Re: IT is not AC program, it got MLE [1] // Problem 1100. Final Standings 8 Feb 2006 18:15
1. Replace 150000 with 150001
2. C++ solution doesn't get MLE even without hi-lo representation, simply use long.
void off() wrote 6 January 2006 20:40
Hmm... It gets MLE, really. Do they count memory on ALL tests, not on every test separately?
Update: I've rewrited it, so it doesn't get MLE:
#include <stdio.h>
void main()
{
  long n;
  unsigned char a[150000];
  unsigned char hi[150000];
  unsigned short lo[150000];
  scanf("%ld",&n);
  for(long i=0;i<n;i++)
  {
    long bod;
    scanf("%ld%d",&bod,&a[i]);
    lo[i]=bod%65536;
    hi[i]=bod/65536;
  }
  for(int v=100;v>=0;v--)
  {
    for(int i=0;i<n;i++)
      if(a[i]==v) printf("%ld %d\n",hi[i]*65536+lo[i],a[i]);
  }
}
How can THIS get WA#11???

Edited by author 06.01.2006 21:12
void off() Re: IT is not AC program, it got MLE // Problem 1100. Final Standings 10 Feb 2006 19:50
> 1. Replace 150000 with 150001
Thanks, it works! AC
fstilus_chiki Re: AC 0.3 Sec 972 KB // Problem 1100. Final Standings 4 Sep 2015 20:12
You are good! Thank you! You are genius!               But my program work faster :-))




































But it doesn't work :-|