Submission #1328005

#TimeUsernameProblemLanguageResultExecution timeMemory
1328005iulimorariuLanguages (IOI10_languages)C++20
Compilation error
0 ms0 KiB
#include <algorithm>
#include <iostream>
#include <fstream>
#include <climits>
#include <vector>
#include <stack>
#include <cmath>
#include <map>
#include "grader.h"
// #include <bits/std++.h>
// #define in  cin
// #define out cout

using namespace std;
const int B = 1e9 + 7;
const int MOD = 998244353;

// pt fiecare limba l eu trebuie sa tin minte media aparitiilor fiecarei grupare de 3 litere
map<int, pair<int, int> > mp[57];
// mp[l][x] = {suma nr de dati, nr de dati} pt language l si codul x
// uhhh idk exact cum osa encodez alea da ma rog e ok
// sa zicem ca le fac numere in baza 1e9 + 7 mod 998244353
// 100% osa fie clashuri dar sa zicem ca e ok for now, osa fac si numa cu 2 ca sa fie mai ok
// dau update la 3 mai incolo

void excerpt(vector<int> E){
    // buuun, acum trebuie sa merg prin fiecare language sa compar

    map<int, int > vf;
    for(int i = 0; i + 1 < E.size(); i++){
        int c = (E[i] * B + E[i + 1]) % MOD;
        vf[c]++;
    }

    int sol = 1, smin = -1;
    for(int l = 1; l <= 56; l++){
        int scor = 0;  // scor = suma de mp[l][ceva] - vf[ceva]

        for(const auto &x : vf){
            scor += (mp[l][x.first].first / mp[l][x.first].second) - x.second;
        }

        if(smin == -1 || scor < smin){
            smin = scor;
            sol = l;
        }
    }

    int fr = language(sol);
    for(const auto &x : vf){
        mp[fr][x.first].first += x.second;
        mp[fr][x.first].second++;
    }
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccUfwrqc.o: in function `main':
grader.c:(.text.startup+0x12f): undefined reference to `excerpt(int*)'
collect2: error: ld returned 1 exit status