Submission #1011970

# Submission time Handle Problem Language Result Execution time Memory
1011970 2024-07-01T12:56:12 Z bachhoangxuan Languages (IOI10_languages) C++17
99 / 100
1776 ms 109744 KB
#include<bits/stdc++.h>
#include "grader.h"
#include "lang.h"
using namespace std;
const int M = 5e5+9;
const int B = 65536;
const int S = 100;
const int L = 4;
const int K = 56;

int a[S+5][L+5],c[K+5][M+5];
int w[]={1,6,1,9};

void excerpt(int *E){
    pair<int,int> mx={0,0};
    for(int i=0;i<=S-L;i++){
        a[i][0]=E[i];
        for(int j=1;j<L;j++) a[i][j]=(1LL*a[i][j-1]*B+E[i+j])%M;
    }
    for(int t=0;t<K;t++){
        int cnt=0;
        for(int i=0;i<=S-L;i++) for(int j=0;j<L;j++) cnt+=min(c[t][a[i][j]],j)*w[j];
        mx=max(mx,{cnt,t});
    }
    int A=language(mx.second);
    for(int i=0;i<=S-L;i++) for(int j=0;j<L;j++) c[A][a[i][j]]++;
}
# Verdict Execution time Memory Grader output
1 Correct 1734 ms 109744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 1776 ms 109708 KB Output is partially correct - 90.92%