#include <stdlib.h>
#include <stdio.h>
#include <bits/stdc++.h>
#include <unordered_map>
#include "grader.h"
#include "lang.h"
#define SZ 100
typedef long long lld;
using namespace std;
const lld MUL = 100000;
const lld MUL2 = MUL*MUL;
static unordered_map <lld, int> word_list[56];
static lld precalc[65536][3];
lld trigram_arr[SZ + 1];
bool isInit = false;
void excerpt(int *E) {
if (!isInit) {
for (int i = 0; i <= 55; i++) {
word_list[i] = unordered_map<lld, int>();
}
for (lld i = 1; i <= 65535; i++) {
precalc[i][1] = i*MUL;
precalc[i][2] = i*MUL2;
}
isInit = true;
}
for (int i = 2; i < SZ; i++) {
trigram_arr[i - 2] = precalc[E[i-2]][2] + precalc[E[i-1]][1] + E[i];
}
int maxs = 0, guess_ans = 0;
for (int i = 0; i <= 55; ++i) {
if (word_list[i].empty()) continue;
int res = 0;
for (int j = 0; j < SZ - 2; ++j) {
lld element = trigram_arr[j];
if (word_list[i].count(element) != 0) {
res += word_list[i][element];
}
}
if (maxs < res) {
guess_ans = i;
maxs = res;
}
}
int real_ans = language(guess_ans);
for (int i = 0; i < SZ - 2; i++) {
word_list[real_ans][trigram_arr[i]]++;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4924 ms |
14448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
4312 ms |
14436 KB |
Output is partially correct - 79.43% |