Submission #511413

#TimeUsernameProblemLanguageResultExecution timeMemory
511413600MihneaLanguages (IOI10_languages)C++17
96 / 100
9411 ms18236 KiB
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"

using namespace std;

typedef long long ll;
const int N = 100;
const int L = 56;
const int B = 65535;
unordered_set<ll> words[L];
int score[L];
bool first = 1;

void excerpt(int *a) {
  if (first) {
    first = 0;

  }
  for (int i = 0; i < N - 3; i++) {
    ll x = a[i];
    ll y = (ll) B * x + a[i + 1];
    ll z = (ll) B * y + a[i + 2];
    for (int l = 0; l < L; l++) {
      score[l] += words[l].count(x);
      score[l] += words[l].count(y) * 2;
      score[l] += words[l].count(z) * 3;
    }
  }
  int highest = -1, prediction = -1;
  for (int l = 0; l < L; l++) {
    if (score[l] > highest) {
      highest = score[l];
      prediction = l;
    }
    score[l] = 0;
  }
  int solution = language(prediction);
  for (int i = 0; i < N - 3; i++) {
    ll x = a[i];
    ll y = (ll) B * x + a[i + 1];
    ll z = (ll) B * y + a[i + 2];
    for (int l = 0; l < L; l++) {
      words[solution].insert(x);
      words[solution].insert(y);
      words[solution].insert(z);
    }
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...