Submission #155333

# Submission time Handle Problem Language Result Execution time Memory
155333 2019-09-27T14:31:41 Z jhnah917 Languages (IOI10_languages) C++14
0 / 100
4234 ms 36132 KB
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
using namespace std;
 
const int n = 100, m = 56;
const int mod = 50021;
 
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){
	long long ret = (long long)a << 16;
	ret |= b;
	ret %= mod;
	return ret;
}
 
int f(int a, int b, int c){
	long long ret = (long long)f(a, b) << 16;
	ret |= c;
	ret %= mod;
	return ret;
}
 
int f(int a, int b, int c, int d){
	long long ret = (long long)f(a, b, c) << 16;
	ret |= d;
	ret %= mod;
	return ret;
}

void excerpt(int *arr){
	double mx = 0;
	int idx = 0;
	for(int i=0; i<m; i++){
		double 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 /= log(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])]++;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 3174 ms 36132 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 4234 ms 36040 KB Output isn't correct - 2.70%