제출 #1279017

#제출 시각아이디문제언어결과실행 시간메모리
1279017user149Languages (IOI10_languages)C++20
0 / 100
1 ms416 KiB
#include <bits/stdc++.h> #include "grader.h" #include "lang.h" using namespace std; using t3i = tuple<int, int, int>; using pdi = pair<double, int>; map<t3i, int> freq[60]; int num[60]; double loss(int l, map<t3i, int> v) { double ans = 0; for (auto [a, b] : v) { ans += pow((freq[l][a]/num[l]) - (b/98.0), 2); } for (auto [a, b] : freq[l]) { if (v.find(a) == v.end()) ans += pow(b/num[l], 2); } return ans; } void excerpt(int *E) { map<t3i, int> v; for (int i = 0; i <= 97; i++) { v[{E[i], E[i+1], E[i+2]}]++; } pdi best = {1e9, -1}; for (int l = 0; l <= 55; l++) { best = min(best, (pdi){loss(l, v), l}); } int ans = language(best.second); num[ans] += 98; for (auto [a, b] : v) { freq[ans][a] += b; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...