Submission #358525

# Submission time Handle Problem Language Result Execution time Memory
358525 2021-01-25T16:53:10 Z idk321 Languages (IOI10_languages) C++11
12 / 100
10000 ms 7916 KB
#include <stdlib.h>
#include <stdio.h>

#include "grader.h"
#include "lang.h"

#define SZ 100

#include <bits/stdc++.h>

using namespace std;

int prev[1100000];
map<int, double> freq [56];
bool vis[56];
int c = 0;

void excerpt(int *E) {
    map<int, double> cfreq;
   for (int i = 0; i < 100; i++)
   {
        cfreq[E[i]]++;
   }

   int best = -1;
   int bscore = -1;
   for (int i = 0; i < 56; i++)
   {
        double score = 0;
        for (auto it = freq[i].begin(); it != freq[i].end(); it++)
        {
            if (it->second != 0 && cfreq[it->first] != 0)
            {
                 score++;
                 score -= abs(it->second - cfreq[it->first]) / 10;
            }
        }
        if (score >  bscore)
        {
            best = i;
            bscore = score;
        }
   }

   int actual = language(best);

   if (!vis[actual])
   {
        vis[actual] = true;
        freq[actual] = cfreq;
   } else
   {
        map<int, double> nfreq;
        for (auto it = freq[actual].begin(); it != freq[actual].end(); it++)
        {
            nfreq[it->first] = (it-> second + cfreq[it->first]) / 2;
        }
        for (auto it = cfreq.begin(); it != cfreq.end(); it++)
        {
            nfreq[it->first] = (it-> second + freq[actual][it->first]) / 2;
        }
   }

   c++;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 10073 ms 5796 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Partially correct 9919 ms 7916 KB Output is partially correct - 40.70%