Submission #2951

# Submission time Handle Problem Language Result Execution time Memory
2951 2013-08-18T13:49:28 Z gs13068 Languages (IOI10_languages) C++
Compilation error
0 ms 0 KB
#include"grader.h"
#include"lang.h"

int langn[56];
int lang[56][65536];
int a[65536];
int b[100];
int c[100];

void excerpt(int *str)
{
  double max=987654321,maxlang;
  double now;
  int i,j,n,sum;
  for(i=0;i<65536;i++)count[i]=0;
  for(i=0;i<100;i++)count[str[i]]++;
  j=0;
  for(i=0;i<65536;i++)if(count[i])
  {
    b[j]=i;
    c[j]=a[i];
    j++;
  }
  for(i=0;i<56;i++)
  {
    sum=65536+langn[i];
    now=0;
    for(j=0;j<100;j++)now+=((lang[i][b[j]]+1.)/sum-c[j])*((lang[i][b[j]]+1.)/sum-c[j]);
    if(now<max)
    {
      max=now;
      maxlang=i;
    }
  }
  n=language(maxlang);
  langn[n]+=100;
  for(i=0;i<65536;i++)lang[n][i]+=count[i];
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:15:23: error: 'count' was not declared in this scope
   for(i=0;i<65536;i++)count[i]=0;
                       ^~~~~
lang.cpp:16:21: error: 'count' was not declared in this scope
   for(i=0;i<100;i++)count[str[i]]++;
                     ^~~~~
lang.cpp:18:26: error: 'count' was not declared in this scope
   for(i=0;i<65536;i++)if(count[i])
                          ^~~~~
lang.cpp:37:35: error: 'count' was not declared in this scope
   for(i=0;i<65536;i++)lang[n][i]+=count[i];
                                   ^~~~~