#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 lan[66];
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];
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 |
Runtime error |
10 ms |
512 KB |
Execution killed with signal 8 (could be triggered by violating memory limits) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
11 ms |
512 KB |
Execution killed with signal 8 (could be triggered by violating memory limits) |