Submission #55639

#TimeUsernameProblemLanguageResultExecution timeMemory
55639choyi0521Languages (IOI10_languages)C++14
100 / 100
4780 ms144292 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...