#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC target("sse4,avx2,fma,avx")
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;
#include "grader.h"
#include "lang.h"
const int SZ = 100, LANGS = 56;
const ll SI_WEIGHT = 1, BI_WEIGHT = 1, TR_WEIGHT = 17, QU_WEIGHT = 74;
ll cnt[LANGS], si[SZ], bi[SZ], tr[SZ], qu[SZ];
unordered_map<ll, unordered_map<int, int>> mp;
void excerpt(int *E) {
FOR(i, 0, LANGS) cnt[i] = 0;
FOR(i, 0, SZ - 3) {
qu[i] = 0;
FOR(j, 0, 4) { qu[i] = (qu[i] << 16) + E[i + j]; }
tr[i] = qu[i] >> 16;
bi[i] = tr[i] >> 16;
si[i] = bi[i] >> 16;
if (mp[qu[i]].size()) {
int best = -1, sim = -1;
for (pair<int, int> k : mp[qu[i]]) {
if (k.second > sim) {
sim = k.second;
best = k.first;
}
}
cnt[best] += QU_WEIGHT;
}
if (mp[tr[i]].size()) {
int best = -1, sim = -1;
for (pair<int, int> k : mp[tr[i]]) {
if (k.second > sim) {
sim = k.second;
best = k.first;
}
}
cnt[best] += TR_WEIGHT;
}
if (mp[bi[i]].size()) {
int best = -1, sim = -1;
for (pair<int, int> k : mp[bi[i]]) {
if (k.second > sim) {
sim = k.second;
best = k.first;
}
}
cnt[best] += BI_WEIGHT;
}
if (mp[si[i]].size()) {
int best = -1, sim = -1;
for (pair<int, int> k : mp[si[i]]) {
if (k.second > sim) {
sim = k.second;
best = k.first;
}
}
cnt[best] += SI_WEIGHT;
}
}
int best = -1, sim = -1;
FOR(i, 0, LANGS) {
if (cnt[i] > sim) {
sim = cnt[i];
best = i;
}
}
int ans = language(best);
FOR(i, 0, SZ - 3) {
mp[qu[i]][ans]++;
mp[tr[i]][ans]++;
mp[bi[i]][ans]++;
mp[si[i]][ans]++;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6241 ms |
95000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
5941 ms |
95076 KB |
Output is partially correct - 88.97% |