Submission #138086

# Submission time Handle Problem Language Result Execution time Memory
138086 2019-07-29T10:03:31 Z Boxworld Languages (IOI10_languages) C++14
81 / 100
689 ms 17188 KB
#include <stdlib.h>
#include <stdio.h>
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"
#define SZ 100
#define X 1000100 
using namespace std;
typedef pair<int,int> P;
map<int,int> M;
int G[X][60],D[X][60],T[X][60];
int F[100],ans[60],cnt2=0,cnt3=0;
int id2(int x,int y){
	int pa=x*65536+y;
	if (M.find(pa)!=M.end())return M[pa];
	return M[pa]=cnt2++;
}
void excerpt(int *E) {
	int mx=0;
	memset(ans,0,sizeof(ans));
	for (int i=0;i<SZ-1;i++)
	F[i]=id2(E[i],E[i+1]);
	for (int i=0;i<SZ;i++)
	for (int j=0;j<56;j++)
	if (G[E[i]][j]==1)ans[j]+=1;
	
	
	for (int i=0;i<SZ-1;i++)
	for (int j=0;j<56;j++)
	if (D[F[i]][j]==1)ans[j]+=3;	
	
	for (int i=0;i<56;i++)
	if (ans[i]>ans[mx])mx=i;
	
	int s = language(mx);
	for (int i=0;i<SZ;i++){
		G[E[i]][s]=1;
		if (i<SZ-1)D[F[i]][s]=1;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 689 ms 17188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 667 ms 17012 KB Output is partially correct - 75.07%