Submission #758640

# Submission time Handle Problem Language Result Execution time Memory
758640 2023-06-15T03:06:20 Z SanguineChameleon Languages (IOI10_languages) C++17
80 / 100
844 ms 11368 KB
#include <stdlib.h>
#include <stdio.h>

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

#define SZ 100

#include <bits/stdc++.h>
using namespace std;

map<int, int> cnt_all[56];
map<int, int> cnt_cur;
int sum[56];

long double calc(int id) {
	long double res = 0.0L;
	for (auto p: cnt_cur) {
		long double exp = 1.0L * (cnt_all[id][p.first] + 1) / (sum[id] + 2000);
		int obs = p.second;
		res += (exp - obs) * (exp - obs) / exp;
	}
	return res;
}


void excerpt(int *E) {
	cnt_cur.clear();
	for (int i = 0; i < 100; i++) {
		cnt_cur[E[i]]++;
	}
	pair<long double, int> best = make_pair(1e18L, -1);
	for (int i = 0; i < 56; i++) {
		best = min(best, make_pair(calc(i), i));
	}
	int id = language(best.second);
	for (int i = 0; i < 100; i++) {
		cnt_all[id][E[i]]++;
	}
	sum[id] += 100;
}
# Verdict Execution time Memory Grader output
1 Correct 844 ms 11332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 843 ms 11368 KB Output is partially correct - 73.80%