Submission #660324

#TimeUsernameProblemLanguageResultExecution timeMemory
660324cristi_aLanguages (IOI10_languages)C++17
0 / 100
1039 ms49056 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; using ll = unsigned long long; static const int hmax = 65535; static const ll B = 65537; static const int L = 100; // B ^ 3 - max // len 4 set<ll> l[56][5]; void excerpt(int E[]) { vector<ll> seq[5]; for(int len=1; len<=4; len++) for(int i=0; i+len-1<L; i++) { ll hval = 0; for(int j=i; j<=i+len-1; j++) hval = B * hval + E[j]; seq[len].emplace_back(hval); } ll mx = -1; int w = 0; for(int i=0; i<56; i++) { ll cnt = 0; for(int len=1; len<=4; len++) for(auto x : seq[len]) if(l[i][len].find(x) != l[i][len].end()) cnt++; if(cnt > mx) { mx = cnt; w = i; } } int ans = language(w); for(int len=1; len<=4; len++) { for(int i=0; i+len-1<L; i++) { ll hval = 0; for(int j=i; j<=i+len-1; j++) hval = B * hval + E[j]; l[ans][len].emplace(hval); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...