Submission #65945

# Submission time Handle Problem Language Result Execution time Memory
65945 2018-08-09T06:40:50 Z llllilll Languages (IOI10_languages) C++14
84 / 100
374 ms 12296 KB
#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 time Memory Grader output
1 Correct 374 ms 12296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 374 ms 12280 KB Output is partially correct - 77.53%