This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 = 4, TR_WEIGHT = 17, QU_WEIGHT = 47;
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |