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

can anyone tell me why i get Compilation Error (Problem 1101)
Posted by GoGo 2 Sep 2001 03:22
I compile it with gcc , Borland C++ 3.1 and Borland C 2.0
and it is OK but when i send it i got Compilation Error :

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct tree
 {
  int info;
  char lit;
  struct tree *l,*r;
 }*btp;

btp root;
char __a[1000],_a[1000],a[1000],c_r[1000];
int _val[1000],val[1000],registru[1000];
int x_f[1000],y_f[1000],x_r[1000],y_r
[1000],lung,n,m,k,sens=3;

void read_data()
 {
  int i,g,h,j=0;char ch;
  gets(__a);
  scanf("%d",&n);
  scanf("%d",&m);
  scanf("%d",&k);
  for(i=0;i<m;i++)
   {
    scanf("%d",&g);
    scanf("%d",&h);
    x_f[j]=g;
    y_f[j++]=h;
   }
  j=0;
  for(i=0;i<k;i++)
   {
    scanf("%d",&g);
    scanf("%d",&h);
    scanf("%c",&ch);
    scanf("%c",&ch);
    x_r[j]=g;
    y_r[j]=h;
    c_r[j++]=ch;
   }
  strupr(c_r);
 }

void inlocuieste()
 {
  int i;
  strupr(__a);
  lung=strlen(__a);
  for(i=0;i<lung;i++)
   {
    if(__a[i]=='A' && __a[i+1]=='N' && __a[i+2]=='D')
     {
      __a[i]='&';
      __a[i+1]=' ';
      __a[i+2]=' ';
     }
    else if(__a[i]=='N' && __a[i+1]=='O' && __a[i+2]=='T')
     {
      __a[i]='/';
      __a[i+1]=' ';
      __a[i+2]=' ';
     }
    else if(__a[i]=='O' && __a[i+1]=='R')
     {
      __a[i]='|';
      __a[i+1]=' ';
     }
    else if(__a[i]=='T' && __a[i+1]=='R' && __a[i+2]=='U'
&& __a[i+3]=='E')
     {
      __a[i]='1';
      __a[i+1]=' ';
      __a[i+2]=' ';
      __a[i+3]=' ';
     }
    else if(__a[i]=='F' && __a[i+1]=='A' && __a[i+2]=='L'
&& __a[i+3]=='S' && __a[i+4]=='E')
     {
      __a[i]='0';
      __a[i+1]=' ';
      __a[i+2]=' ';
      __a[i+3]=' ';
      __a[i+4]=' ';
     }
   }
 }

void micsoreaza()
 {
  int i,j=0;
  for(i=0;i<lung;i++)
   if(__a[i]!=' ')
    _a[j++]=__a[i];
  lung=j;
 }

void scoate_parantezele()
 {
  int i,j=0,t=0;
  for(i=0;i<lung;i++)
   switch(_a[i])
    {
     case '(':{t+=1000;break;}
     case ')':{t-=1000;break;}
     case '/':{_val[i]=300+t;break;}
     case '&':{_val[i]=100+t;break;}
     case '|':{_val[i]=10+t;break;}
    }
  for(i=0;i<lung;i++)
   if(_a[i]!='(' && _a[i]!=')')
    {
     a[j]=_a[i];
     val[j++]=_val[i];
    }
  lung=j;
 }

int minimumu(int i,int j)
 {
  int k,z,m=30000;
  for(k=i;k<=j;k++)
   if(val[k] && val[k]<m)
    {
     z=k;
     m=val[k];
    }
  return(z);
 }

void building(btp root,int i,int j)
 {
  int k;
  if(i==j)
   {
    root->l=NULL;
    root->r=NULL;
    root->info=1;
    root->lit=a[i];
   }
  else
   {
    k=minimumu(i,j);
    switch(a[k])
     {
      case '/':
       {
    root->info=0;
    root->lit='/';
    root->l=NULL;
    root->r=(btp)malloc(sizeof(struct tree));
    building(root->r,k+1,j);
    break;
       }
      default:
       {
    root->info=0;
    root->lit=a[k];
    root->l=(btp)malloc(sizeof(struct tree));
    root->r=(btp)malloc(sizeof(struct tree));
    building(root->l,i,k-1);
    building(root->r,k+1,j);
       }
     }
   }
 }

int evaluate(btp root)
 {
  int z;
  if(root->info)
   if(root->lit=='1')return(1);
   else if(root->lit=='0')return(0);
   else return(registru[root->lit]);
  else
   switch(root->lit)
    {
     case '/':{z=!evaluate(root->r);break;}
     case '&':{z=evaluate(root->r) && evaluate(root-
>l);break;}
     case '|':{z=evaluate(root->r) || evaluate(root-
>l);break;}
    }
  return(z);
 }

int este_furculita(int x,int y)
 {
  int i,da=0;
  for(i=0;(i<m && !da);i++)
   if(x==x_f[i] && y==y_f[i])da=1;
  return(da);
 }

int este_reg(int x,int y)
 {