#include "grader.h"
//#include "languages.h"
#include <bits/stdc++.h>
#include <unordered_map>
#define F first
#define S second
typedef long long ll;
using namespace std;
unordered_map <string ,int> LL;
unordered_map <string ,int> val;
double lang[100]={0};
int E[1010];
int ans;
void check(int st,int en){
string s="";
for (int i=st;i<en;i++){
s+=(char)E[i];
}
int v=val[s];
v=max(v,1);
double res=1.0/(double)v;
if (LL[s]==0)return ;
lang[LL[s]-1]+=res;
}
void add(int st,int en){
string s="";
for (int i=st;i<en;i++){
s+=(char)E[i];
}
if (LL[s]!=ans)val[s]++;
LL[s]=ans;
}
void excerpt(int EE[]){
for (int i=0;i<100;i++)E[i]=EE[i];
int f[100010]={0};
pair<int,int> mx={0,0};
for (int i=0;i<100;i++){
f[E[i]]++;
mx=max(mx,{f[E[i]],E[i]});
}
int last=0;
for (int i=0;i<100;i++){
if (E[i]==mx.S){
check(last,i);
last=i+1;
}
}
check(last,100);
pair<double,int> L;
for (int i=0;i<60;i++){
L=max(L,{lang[i],i});
}
ans=language(L.S);
last=0;
for (int i=0;i<100;i++){
if (E[i]==mx.S){
add(last,i);
last=i+1;
}
}
add(last,100);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
640 KB |
Hacked. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
768 KB |
Hacked. |