Submission #588145

#TimeUsernameProblemLanguageResultExecution timeMemory
588145DeepessonLanguages (IOI10_languages)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "lang.h"
#include "grader.h"
#define fi first
#define se second
#define pb push_back

using ll = long double;
std::map<ll, ll> lang[60];
int tot[60];
void excerpt(int *E)
{
    std::map<ll,ll> fracoes;
    for(int i=0;i!=100;++i){
        fracoes[E[i]]++;
    }

    {
        int best=0;score=1e9;
        for(int i=0;i!=60;++i){
            if(!tot[i])continue;
            long double penalidade=0;
            for(auto&y:lang[i]){
                long double x = y.second;
                x/=(double)tot[i];
                x*=1000;
                double dif = abs(x-(fracoes[y.first]/100.0));
                dif*=1000;
                penalidade+=dif*dif;
            }
            if(penalidade<score){
                best=i;
                score=penalidade;
                continue;
            }
        }
        int k = language(best);
        for(int i=0;i!=100;++i){
            tot[k]++;
            lang[k][E[i]]++;
        }
    }
}

Compilation message (stderr)

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:19:20: error: 'score' was not declared in this scope
   19 |         int best=0;score=1e9;
      |                    ^~~~~