#include<bits/stdc++.h>
#include "lang.h"
#include "grader.h"
#define fi first
#define se second
using namespace std;
//////////////////
//const int N=10;
//int L;
//int language(int l)
//{
// cerr<<l<<"\n";
// return L;
//}
/////////////////
const int N=100;
const int K=4;
map<pair<int,long long>,map<int,int>> mp;
pair<int,long long> hsh(int E[],int d)
{
long long ans=0;
for(int i=0;i<=d;i++)
{
ans<<=16;
ans+=E[i];
}
return make_pair(d,ans);
}
vector<pair<int,long long>> all_fragments(int E[])
{
vector<pair<int,long long>> tmp;
for(int d=0;d<K;d++)
{
for(int i=0;i+d<N;i++)
tmp.push_back(hsh(E+i,d));
}
return tmp;
}
void excerpt(int E[])
{
vector<pair<int,long long>> t=all_fragments(E);
vector<int> cnt(56,0);
for(auto v:t)
{
//cerr<<v.fi<<" "<<v.se<<"\n";
for(auto l:mp[v])
cnt[l.fi]+=l.se;
}
int mx=0,g=0;
for(int i=0;i<56;i++)
{
if(cnt[i]>mx)
{
mx=cnt[i];
g=i;
}
}
int lang=language(g);
for(auto v:t)
mp[v][lang]++;
return;
}
//////////////////////////
//int main()
//{
// int n;
// cin>>n;
// for(int i=1;i<=n;i++)
// {
// string s;
// cin>>L>>s;
// int E[N];
// for(int j=0;j<N;j++)
// E[j]=s[j];
// excerpt(E);
// }
// return 0;
//}
//////////////////////////
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6615 ms |
98132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
6700 ms |
98020 KB |
Output is partially correct - 36.76% |