Submission #65854

# Submission time Handle Problem Language Result Execution time Memory
65854 2018-08-09T04:09:26 Z llllilll Languages (IOI10_languages) C++14
66 / 100
6860 ms 5160 KB
#include <stdlib.h>
#include <stdio.h>
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"

#define SZ 100
using namespace std;

static map<int, int> word_list[56];
bool isInit = false;

void excerpt(int *E) {
	if (!isInit) {
		for (int i = 0; i <= 55; i++) {
			word_list[i] = map<int, int>();
		}
		isInit = true;
	}
	
	int bigram_arr[SZ + 1];
	for (int i = 1; i < SZ; i++) {
		int bigram = E[i - 1] * 100000 + E[i];
		bigram_arr[i - 1] = bigram;
	}
	
	int maxs = 0, guess_ans = 0;

	for (int i = 0; i <= 55; i++) {
		int res = 0;

		for (int j = 0; j < SZ; j++) {
			int element = bigram_arr[j];
			if (word_list[i].count(element) != 0) {
				res += word_list[i][element];
			}
		}

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

	int real_ans = language(guess_ans);

	for (int i = 0; i < SZ; i++) {
		word_list[real_ans][bigram_arr[i]] += 1;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 6757 ms 5160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 6860 ms 4924 KB Output is partially correct - 61.26%