Submission #1327032

#TimeUsernameProblemLanguageResultExecution timeMemory
1327032apxoLanguages (IOI10_languages)C++20
38 / 100
1531 ms218280 KiB
#include "bits/stdc++.h"

using namespace std;

#ifdef duc_debug
#include "bits/debug.h"
#else
#define debug(...)
#include "grader.h"
#endif

const int mod = 999983;
const int base = 65537;
int a[99][4];
int d[56][mod];
int weight[] = {1, 1, 1, 1};

void excerpt(int *E) {
  for (int i = 0; i < 97; ++i) {
    for (int j = 0; j < 4; ++j) {
      a[i][j] = (1ll * (j ? a[i][j - 1] : 0) * base % mod + E[i + j]) % mod;
    }
  }  
  int match = 0, pos = 0;
  for (int i = 0; i < 56; ++i) {
    int cur = 0;
    for (int j = 0; j < 97; ++j) {
      for (int k = 0; k < 4; ++k) {
        cur += d[i][a[j][k]] * weight[k];
      }
    }
    if (match < cur) {
      match = cur, pos = i;
    }
  }
  int L = language(pos);
  for (int i = 0; i < 97; ++i) {
    for (int j = 0; j < 4; ++j) {
      ++d[L][a[i][j]];
    }
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...