This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdlib.h>
#include <stdio.h>
#include "grader.h"
#include "lang.h"
#define SZ 100
int prev[1100000];
int ha[60][3][428957];
int htot[3][428957];
int cp(int* s, int l) {
long long res = 0, mod = 428957;
for (int i = 0; i < l; i++) {
res = (res * 70000 + s[i]) % mod;
}
return (int)res;
}
int w[3] = { 1, 30, 90 };
void excerpt(int *E) {
long long maxi = -1, ans = -1;
for (int lan = 0; lan < 56; lan++) {
long long res = 0;
for (int i = 0; i < 3; i++) {
long long s = 0;
for (int j = 0; j < 100 - i; j++) {
int h = cp(E + j, i + 1);
if(htot[i][h]) s += 10000*ha[lan][i][h] / htot[i][h];
}
res += s*w[i];
}
if (res > maxi) {
maxi = res;
ans = lan;
}
}
int re = language(ans);
for (int i = 0; i < 3; i++) {
long long s = 0;
for (int j = 0; j < 100 - i; j++) {
int p = cp(E + j, i + 1);
ha[re][i][p]++;
htot[i][p]++;
}
}
}
Compilation message (stderr)
lang.cpp: In function 'void excerpt(int*)':
lang.cpp:40:19: warning: unused variable 's' [-Wunused-variable]
long long s = 0;
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |