제출 #1331817

#제출 시각아이디문제언어결과실행 시간메모리
1331817adaawfLanguages (IOI10_languages)C++20
88 / 100
2982 ms26948 KiB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int b = 177013, mod = 998244353;
unordered_map<long long int, int> mm[105][5];
mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
void excerpt(int s[]) {
    for (int i = 0; i < 100; i++) s[i] += 26;
    vector<long long int> v[5];
    for (int jj = 1; jj <= 4; jj++) {
        for (int i = 0; i <= 100 - i; i++) {
            long long int h = 0;
            for (int j = i; j < i + jj; j++) {
                h = h * b + s[j];
                h %= mod;
            }
            v[jj].push_back(h);
        }
    }
    int ma = 0, h = 0;
    for (int i = 0; i < 56; i++) {
        int d = 0, c = 1;
        for (int j = 1; j <= 4; j++) {
            for (auto w : v[j]) {
                if (mm[i][j].count(w)) d += c;
            }
            c *= 2;
        }
        if (d > ma) {
            ma = d;
            h = i;
        }
    }
    h = language(h);
    for (int j = 1; j <= 4; j++) {
        for (auto w : v[j]) mm[h][j][w] = 1;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...