Submission #434367

# Submission time Handle Problem Language Result Execution time Memory
434367 2021-06-21T05:10:56 Z KoD Languages (IOI10_languages) C++17
99 / 100
3727 ms 223492 KB
#include <bits/extc++.h>
#include "grader.h"
#include "lang.h"

using ll = long long;
using ull = unsigned long long;

constexpr int SIZE = 100;
constexpr int LANG = 56;
constexpr int LETTER = 65536;
constexpr int LEN = 4;
constexpr int MOD = 1000007;
constexpr double COEFF[] = {1.0, 10.0, 1.0, 10.0};

int appeared[LANG];
int freq[LANG][MOD];

void excerpt(int *E) {
    double point[LANG] = {};
    ull hash[SIZE] = {};
    for (int k = 0; k < LEN; ++k) {
        for (int i = 0; i < SIZE - k; ++i) {
            hash[i] = LETTER * hash[i] + E[i + k];
            for (int j = 0; j < LANG; ++j) {
                point[j] += COEFF[k] * (freq[j][hash[i] % MOD] != 0);
            }
        }
    }
    const int type = language(std::max_element(point, point + LANG) - point);
    appeared[type] += 1;
    std::fill(hash, hash + SIZE, 0);
    for (int k = 0; k < LEN; ++k) {
        for (int i = 0; i < SIZE - k; ++i) {
            hash[i] = LETTER * hash[i] + E[i + k];
            freq[type][hash[i] % MOD] += 1;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 3727 ms 223492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 3661 ms 223452 KB Output is partially correct - 90.32%