Submission #404855

#TimeUsernameProblemLanguageResultExecution timeMemory
404855JasiekstrzLanguages (IOI10_languages)C++17
100 / 100
9327 ms183900 KiB
#include<bits/stdc++.h> #include "lang.h" #include "grader.h" #define fi first #define se second using namespace std; const long long MOD=1e9+7,B=65537; const int N=100; const int K=5; map<pair<int,long long>,set<int>> mp; pair<int,long long> hsh(int E[],int d) { long long ans=0; for(int i=0;i<=d;i++) ans=(ans*B+E[i])%MOD; 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) { for(auto l:mp[v]) cnt[l]++; } 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].insert(lang); return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...