답안 #155309

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
155309 2019-09-27T14:06:48 Z jhnah917 Languages (IOI10_languages) C++14
98 / 100
4088 ms 22620 KB
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
using namespace std;

const int n = 100, m = 56;
const int mod = 1e5+19, base = 917;

int cnt[66][101010];
int cnt2[66][101010];
int cnt3[66][101010];
int cnt4[66][101010];

int f(int a, int b){
	int ret = a;
	ret = (ret * base + b) % mod;
	return ret;
}

int f(int a, int b, int c){
	int ret = a;
	ret = (ret * base + b) % mod;
	ret = (ret * base + c) % mod;
	return ret;
}

int f(int a, int b, int c, int d){
	int ret = a;
	ret = (ret * base + b) % mod;
	ret = (ret * base + c) % mod;
	ret = (ret * base + d) % mod;
	return ret;
}

void excerpt(int *arr){
	int mx = 0, idx = 0;
	for(int i=0; i<m; i++){
		int now = 0;
		for(int j=0; j<n; j++){
			if(cnt[i][arr[j]]) now++;
			if(j == n-1) break;
			if(cnt[i][f(arr[j], arr[j+1])]) now++;
			if(j == n-2) break;
			if(cnt[i][f(arr[j], arr[j+1], arr[j+2])]) now++;
			if(j == n-3) break;
			if(cnt[i][f(arr[j], arr[j+1], arr[j+2], arr[j+3])]) now++;
		}
		if(now > mx){
			mx = now; idx = i;
		}
	}
	
	int ans = language(idx);
	for(int i=0; i<n; i++){
		cnt[ans][arr[i]] = 1;
		if(i == n-1) break;
		cnt[ans][f(arr[i], arr[i+1])] = 1;
		if(i == n-2) break;
		cnt[ans][f(arr[i], arr[i+1], arr[i+2])] = 1;
		if(i == n-3) break;
		cnt[ans][f(arr[i], arr[i+1], arr[i+2], arr[i+3])] = 1;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3542 ms 22516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 4088 ms 22620 KB Output is partially correct - 89.70%