Submission #758673

#TimeUsernameProblemLanguageResultExecution timeMemory
758673SanguineChameleonLanguages (IOI10_languages)C++17
79 / 100
861 ms11324 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...