#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
#include "lang.h"
typedef long double LD;
typedef long long ll;
#define int ll
#define pb push_back
#define mp make_pair
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
typedef unordered_map<int,signed> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
#define F first
#define S second
#define PQ(type) priority_queue<type>
#define PQD(type) priority_queue<type,vector<type>,greater<type> >
#define WL(t) while(t --)
#define SZ(x) ((int)(x).size())
#define runtime() ((double)clock() / CLOCKS_PER_SEC)
#define inrange(i,a,b) ((i>=min(a,b)) && (i<=max(a,b)))
const int LA = 56;
const int CH = 65536;
const int SZ = 100;
int cnt1[LA][CH];
mii cnt2[LA];
mii cnt3[LA];
int tot[LA];
void excerpt(signed *E){
int l = 0;
pii f = {0,1};
vector<pair<long double,int> > gg;
REP(i,LA){
int num = 0;
int den = tot[i]+1;
REP(j,SZ){
num += cnt1[i][E[j]];
}
REP(j,SZ-2){
num += cnt3[i][E[j]*CH*CH+E[j+1]*CH+E[j+2]]*SZ*SZ;
}
gg.pb({(long double)num/(long double) den,i});
}
sort(all(gg));
FOR(j,51,56){
int i = gg[j].S;
int den = tot[i]+1;
int num = den*gg[j].F;
REP(j,SZ-1){
num += cnt2[i][E[j]*CH+E[j+1]]*SZ;
}
if(f.F*den < num*f.S){
f = {num,den};
l = i;
}
}
int lang = language(l);
tot[lang] += SZ;
REP(i,100) cnt1[lang][E[i]]++;
REP(i,99) cnt2[lang][E[i]*CH+E[i+1]]++;
REP(i,98) cnt3[lang][E[i]*CH*CH+E[i+1]*CH+E[i+2]]++;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6780 ms |
262148 KB |
Execution killed with signal 9 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6708 ms |
262148 KB |
Execution killed with signal 9 |