Submission #914734

#TimeUsernameProblemLanguageResultExecution timeMemory
914734abcvuitunggioLanguages (IOI10_languages)C++17
100 / 100
3582 ms100776 KiB
#include <bits/stdc++.h> #include "grader.h" #include "lang.h" #define MOD 458047 using namespace std; int a[97][4],d[56][MOD],p[4]={1,6,1,9}; void excerpt(int *E){ pair <int, int> mx={0,0}; for (int i=0;i<97;i++){ a[i][0]=E[i]; for (int j=1;j<4;j++) a[i][j]=(a[i][j-1]*65536LL+E[i+j])%MOD; } for (int i=0;i<56;i++){ int cnt=0; for (int j=0;j<97;j++) for (int k=0;k<4;k++) cnt+=min(d[i][a[j][k]],k)*p[k]; mx=max(mx,{cnt,i}); } int res=language(mx.second); for (int i=0;i<97;i++) for (int j=0;j<4;j++) d[res][a[i][j]]++; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...