제출 #300570

#제출 시각아이디문제언어결과실행 시간메모리
300570fishy15Languages (IOI10_languages)C++17
66 / 100
2253 ms21240 KiB
#include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <array> #include <algorithm> #include <utility> #include <map> #include <queue> #include <set> #include <cmath> #include <cstdio> #include <cstring> #include "lang.h" #include "grader.h" #define ll long long #define ld long double #define eps 1e-8 #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f3f // change if necessary #define MAXN 70000 using namespace std; // replace this back when submit const int LEN = 100; const int LANGS = 56; struct val { int tot; int freq[MAXN]; val() { memset(freq, 0, sizeof freq); } double qry(int arr[LEN]) { if (tot == 0) return -INFLL; double ans = 0; for (int i = 0; i < LEN; i++) { ans += log(1.0 * freq[arr[i]] / tot); } return ans; } void upd(int arr[LEN]) { tot += LEN; for (int i = 0; i < LEN; i++) { freq[arr[i]]++; } } }; val langs[LANGS]; void excerpt(int arr[LEN]) { ll max_val = -INFLL; int ans = 0; for (int i = 0; i < LANGS; i++) { double val = langs[i].qry(arr); if (val > max_val) { max_val = val; ans = i; } } int correct = language(ans); langs[correct].upd(arr); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...