Submission #67579

# Submission time Handle Problem Language Result Execution time Memory
67579 2018-08-15T03:43:44 Z usefulhyun Languages (IOI10_languages) C++17
52 / 100
10000 ms 5320 KB
#include <stdlib.h>
#include <stdio.h>
#include <unordered_map>
using namespace std;

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

#define SZ 100

unordered_map<int, int> occurrence[56];

void excerpt(int *E) {
	
	int guess = 0;
	int max_similarity = 0;
	for (int lang = 0; lang < 56; lang++) {
		int similarity = 0;
		unordered_map<int, bool> words;

		for (int i = 0; i < 100; i++) {
			int key = E[i];
			words[key] = true;
		}

		for (int i = 0; i < 99; i++) {
			int key = E[i] * 65536 + E[i + 1];
			words[key] = true;
		}

		for (auto itr = words.begin(); itr != words.end(); itr++) {
			int key = itr->first;

			if (occurrence[lang].find(key) != occurrence[lang].end())
				similarity++;
		}
		

		if (max_similarity < similarity) {
			max_similarity = similarity;
			guess = lang;
		}
	}


	int ans = language(guess);

	for (int i = 0; i < 100; i++) {
		int key = E[i];
		occurrence[ans][key] = 1;
	}

	for (int i = 0; i < 99; i++) {
		int key = E[i] * 65536 + E[i + 1];
		occurrence[ans][key] = 1;
	}

//	printf("%d %d\n", guess, ans);

}
# Verdict Execution time Memory Grader output
1 Execution timed out 10038 ms 5308 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Partially correct 9576 ms 5320 KB Output is partially correct - 75.42%