제출 #65945

#제출 시각아이디문제언어결과실행 시간메모리
65945llllilllLanguages (IOI10_languages)C++14
84 / 100
374 ms12296 KiB
#include <stdlib.h>
#include <stdio.h>
#include <bits/stdc++.h>
#include <unordered_map>
#include "grader.h"
#include "lang.h"

#define SZ 100
typedef long long lld;
using namespace std;

static int word_list[56][65536];
lld trigram_arr[SZ + 1];
bool isInit = false;

int hash2(int a, int b, int c) {
	return (a * 37 + b * 59 + c) % 65536;
}

void excerpt(int *E) {
	for (int i = 2; i < SZ; i++) {
		trigram_arr[i - 2] = hash2(E[i - 2], E[i - 1], E[i]);
	}
	
	int maxs = 0, guess_ans = 0;

	for (int i = 0; i <= 55; ++i) {
		int res = 0;
		for (int j = 0; j < SZ - 2; ++j) {
			res += word_list[i][trigram_arr[j]];
		}

		if (maxs < res) {
			guess_ans = i;
			maxs = res;
		}
	}

	int real_ans = language(guess_ans);

	for (int i = 0; i < SZ - 2; i++) {
		word_list[real_ans][trigram_arr[i]]++;
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...