답안 #155327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
155327 2019-09-27T14:27:55 Z jhnah917 Languages (IOI10_languages) C++14
0 / 100
3251 ms 36296 KB
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
using namespace std;
 
const int n = 100, m = 56;
const int mod = 50021, base = 917;
 
int cnt[57][50505];
int cnt2[57][50505];
int cnt3[57][50505];
int cnt4[57][50505];
int lan[57];
 
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++){
			now += cnt[i][arr[i]];
			if(j >= n-1) continue;
			now += cnt2[i][f(arr[j], arr[j+1])];
			if(j >= n-2) continue;
			now += cnt3[i][f(arr[j], arr[j+1], arr[j+2])];
			if(j >= n-3) continue;
			now += cnt4[i][f(arr[j], arr[j+1], arr[j+2], arr[j+3])];
		}
		now /= (lan[i] + 1);
		if(now > mx){
			mx = now; idx = i;
		}
	}
	
	int ans = language(idx);
	lan[ans]++;
	for(int i=0; i<n; i++){
		cnt[ans][arr[i]]++;
		if(i >= n-1) continue;
		cnt2[ans][f(arr[i], arr[i+1])]++;
		if(i >= n-2) continue;
		cnt3[ans][f(arr[i], arr[i+1], arr[i+2])]++;
		if(i >= n-3) continue;
		cnt4[ans][f(arr[i], arr[i+1], arr[i+2], arr[i+3])]++;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3251 ms 36296 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2832 ms 36004 KB Output isn't correct - 2.51%