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

Common Board

Why compilation error? (+)
Posted by chimney-sweep 26 Feb 2005 22:09
I really don't know why. Here is my code:
---
program d1041;
const
  eps=1e-10;
  maxn=50;
  maxm=2000;
var
  a:array[0..maxm,1..maxn] of double;
  on,c:array[1..maxm] of integer;
  ans:array[1..maxn] of integer;
  i,j,k,p,m,n:integer;
  sum:longint;
  max,t:double;
procedure sort(l,r:integer);
var
  i,j,x1,x2,y:integer;
begin
  i:=l+random(r-l+1);
  x1:=c[i];
  x2:=on[i];
  i:=l;
  j:=r;
  repeat
    while (c[i]<x1) or ((c[i]=x1) and (on[i]<x2)) do
      inc(i);
    while (x1<c[j]) or ((x1=c[j]) and (x2<on[j])) do
      dec(j);
    if i<=j then
    begin
      a[0]:=a[i];
      a[i]:=a[j];
      a[j]:=a[0];
      y:=c[i];
      c[i]:=c[j];
      c[j]:=y;
      y:=on[i];
      on[i]:=on[j];
      on[j]:=y;
      inc(i);
      dec(j);
    end;
  until i>j;
  if l<j then
    sort(l,j);
  if i<r then
    sort(i,r);
end;
begin
{  assign(input,'1.txt');
  reset(input);}
  readln(m,n);
  for i:=1 to m do
  begin
    on[i]:=i;
    for j:=1 to n do
      read(a[i,j]);
    readln;
  end;
  for i:=1 to m do
    readln(c[i]);
  sort(1,m);
  sum:=0;
  p:=1;
  for i:=1 to m do
  begin
    if p=n+1 then
      break;
    max:=abs(a[i,p]);
    k:=p;
    for j:=p+1 to n do
      if abs(a[i,j])>max then
      begin
        max:=abs(a[i,j]);
        k:=j;
      end;
    if abs(max)<eps then
      continue;
    for j:=i to m do
    begin
      t:=a[j,p];
      a[j,p]:=a[j,k];
      a[j,k]:=t;
    end;
    for k:=p+1 to n do
    begin
      t:=a[i,k]/a[i,p];
      for j:=i to m do
        a[j,k]:=a[j,k]-t*a[j,p];
    end;
    ans[p]:=on[i];
    inc(sum,c[i]);
    inc(p);
  end;
  if p<n+1 then
  begin
    writeln('0');
    exit;
  end;
  writeln(sum);
  for i:=1 to n-1 do
  begin
    k:=1;
    for j:=2 to n-1 do
      if ans[j]<ans[k] then
        k:=j;
    writeln(ans[k]);
    ans[k]:=32000;
  end;
end.
'on' is a reserved word, so try to replace it with 'on1', for example (-)
Posted by Dmitry 'Diman_YES' Kovalioff. Retired 26 Feb 2005 22:57
Re:
Posted by chimney-sweep 27 Feb 2005 11:50
Big thanks. But I hasn't errors compiling this source on my local machine. Maybe judge system call compiler with some command line switches?

---
D:\work\olimp\acm.timus>dcc32 d1041.dpr
Borland Delphi Version 15.0
Copyright (c) 1983,2002 Borland Software Corporation
d1041.dpr(110)
111 lines, 0.20 seconds, 13328 bytes code, 818457 bytes data.