제출 #760506

#제출 시각아이디문제언어결과실행 시간메모리
760506SanguineChameleonLanguages (IOI10_languages)C++17
99 / 100
9596 ms39276 KiB
#include <stdlib.h>
#include <stdio.h>

#include "grader.h"
#include "lang.h"

#define SZ 100

#include <bits/stdc++.h>
using namespace std;

unordered_set<long long> words[56][4];
long long score[56];
int weight[4];

void excerpt(int *E) {
	weight[0] = 2;
	weight[1] = 3;
	weight[2] = 4;
	weight[3] = 5;
	for (int i = 0; i < 56; i++) {
		score[i] = 0;
	}
	for (int len = 1; len <= 4; len++) {
		for (int i = 0; i < 101 - len; i++) {
			unsigned long long h = 0;
			for (int j = 0; j < len; j++) {
				h = h << 16 | E[i + j];
			}
			for (int j = 0; j < 56; j++) {
				score[j] += words[j][len - 1].count(h) * weight[len - 1];
			}
		}
	}
	pair<long long, int> best = make_pair(-1, -1);
	for (int i = 0; i < 56; i++) {
		best = max(best, make_pair(score[i], i));
	}
	int ans = language(best.second);
	for (int len = 1; len <= 4; len++) {
		for (int i = 0; i < 101 - len; i++) {
			unsigned long long h = 0;
			for (int j = 0; j < len; j++) {
				h = h << 16 | E[i + j];
			}
			words[ans][len - 1].insert(h);
		}
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...