#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
using namespace std;
const int n = 100, m = 56;
const int mod = 80021;
int cnt[57][80808];
int cnt2[57][80808];
int cnt3[57][80808];
int cnt4[57][80808];
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;
}
double f(int x){
return (double)x / (x + 1);
}
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 += f(cnt[i][arr[i]]);
if(j >= n-1) continue;
now += f(cnt2[i][f(arr[j], arr[j+1])]) * 100;
if(j >= n-2) continue;
now += f(cnt3[i][f(arr[j], arr[j+1], arr[j+2])]) * 150;
if(j >= n-3) continue;
now += f(cnt4[i][f(arr[j], arr[j+1], arr[j+2], arr[j+3])]) * 100;
}
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])]++;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3866 ms |
55300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3919 ms |
55356 KB |
Output is correct - 92.40% |