Submission #588157

#TimeUsernameProblemLanguageResultExecution timeMemory
588157DeepessonLanguages (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 long;
ll lang[60][66000];
std::map<ll,ll> mapa[60][126000];
ll tot[60];
ll duptot[60];
void excerpt(int *E)
{

    {
        int best=0;double score=0;
        for(int i=0;i!=60;++i){
            if(!tot[i])continue;
            long double bonus=0;
            for(int j=0;j!=100;++j){
                bonus+=(double)lang[i][E[j]] / (double)tot[i];
            }
            for(int j=0;j!=99;++j){
                ll ind = E[j] * 100000 +  (E[j+1]);
                bonus+=(double)mapa[i][ind] / (double)duptot[i];
            }
            if(bonus>=score){
                best=i;
                score=bonus;
                continue;
            }
        }
        int k = language(best);
        for(int i=0;i!=100;++i){
            tot[k]++;
            lang[k][E[i]]++;
        }
        for(int j=0;j!=99;++j){
            ll ind = E[j] * 100000 +  (E[j+1]);
            mapa[k][ind]++;
            duptot[k]++;
        }
    }
}

Compilation message (stderr)

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:26:24: error: invalid cast from type 'std::map<long long int, long long int>' to type 'double'
   26 |                 bonus+=(double)mapa[i][ind] / (double)duptot[i];
      |                        ^~~~~~~~~~~~~~~~~~~~
lang.cpp:41:25: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   41 |             mapa[k][ind]++;
      |             ~~~~~~~~~~~~^~