Submission #252345

# Submission time Handle Problem Language Result Execution time Memory
252345 2020-07-25T10:50:24 Z SamAnd Languages (IOI10_languages) C++17
70 / 100
4564 ms 1288 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"
using namespace std;
const int N = 60;

const int m = 100;

map<int, int> s[N];
int ss[N];

void excerpt(int *E)
{
    //sort(E, E + m);
    map<int, int> ys;
    for (int i = 0; i < m; ++i)
        ys[E[i]]++;

    double minu = 1000000000;
    int mini = -1;
    for (int i = 0; i < 55; ++i)
    {
        double q = 0;

        set<int> g;
        for (int i = 0; i < m; ++i)
            g.insert(E[i]);
        //for (auto it = s[i].begin(); it != s[i].end(); ++it)
        //    g.insert(it->first);
        for (auto it = g.begin(); it != g.end(); ++it)
        {
            int x = *it;
            double u1 = 0;
            if (ys.find(x) != ys.end())
                u1 = ys[x] / (double)m;
            double u2 = 0;
            if (s[i].find(x) != s[i].end())
                u2 = s[i][x] / (double)ss[i];
            q += abs(u1 - u2);
        }

        if (q < minu)
        {
            minu = q;
            mini = i;
        }
    }

    int u = language(mini);
    ss[u] += m;
    for (int j = 0; j < m; ++j)
    {
        s[u][E[j]]++;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 4564 ms 1288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 4308 ms 1044 KB Output is partially correct - 64.75%