Submission #292249

# Submission time Handle Problem Language Result Execution time Memory
292249 2020-09-06T15:34:55 Z amiratou Languages (IOI10_languages) C++14
65 / 100
2299 ms 1560 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"
#define SZ 100
#define fi first
#define se second
using namespace std;

map<int,pair<double,double> > freq[56];

void excerpt(int *E) {
	map<int,double> mymap;
	for (int i = 0; i < SZ; ++i)
		mymap[E[i]]++;
	double maxi=1e18;
	int idx=-1;
	for (int l = 0; l < 56; ++l)
	{
		double cost=0;
		for(auto it:mymap){
			double h=0;
			if(freq[l].count(it.fi))
				h=freq[l][it.fi].fi/freq[l][it.fi].se;
			cost+=abs(it.se-h);
		}
		cost/=((double)(mymap.size()));
		if(cost<=maxi)maxi=cost,idx=l;
	}
	assert(idx!=-1);
	int L=language(idx);
	for(auto it:mymap){
		freq[L][it.fi].fi+=it.se;
		freq[L][it.fi].se++;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2281 ms 1448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 2299 ms 1560 KB Output is partially correct - 60.28%