#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) {
if (cnt_all[id][p.first] == 0) {
res += 1e12L * p.second * p.second;
continue;
}
long double exp = 100.0L * (cnt_all[id][p.first]) / (sum[id]);
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(1e100L, -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 |
861 ms |
11296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
861 ms |
11324 KB |
Output is partially correct - 72.73% |