Submission #82773

#TimeUsernameProblemLanguageResultExecution timeMemory
82773naoaiLanguages (IOI10_languages)C++14
56 / 100
1205 ms1180 KiB
#include <bits/stdc++.h> using namespace std; #include "grader.h" #include "lang.h" typedef unsigned long long u64; static const int mod = 666013; static const int nmax = 100; static const int lgmax = 1; static const int nrlang = 56; static const int base = 218279; bool viz[nrlang]; int c[nmax + 1]; u64 hp[nmax + 1][nmax + 1]; unordered_set<u64> h; void baga (int l, u64 x) { h.insert(x * 61 + l); } bool cauta (int l, u64 x) { return (h.find(x * 61 + l) != h.end()); } void excerpt(int *E) { int bstcost = -1, bstlang = 0; for (int i = 1; i <= nmax; ++ i) { for (int j = i; j <= i + lgmax; ++ j) { hp[i][j] = hp[i][j - 1] * base + E[j - 1]; } } for (int l = 0; l < nrlang; ++ l) { if (viz[l] == 0) continue; c[0] = 0; for (int i = 1; i <= nmax; ++ i) { c[i] = 0; for (int j = max(0, i - lgmax); j < i; ++ j) { c[i] = max(c[i], c[j] + cauta(l, hp[j + 1][i]) * (i - j) * (i - j)); } } if (c[nmax] > bstcost) { bstcost = c[nmax]; bstlang = l; } } int ans = language(bstlang); viz[ans] = 1; for (int i = 1; i <= nmax; ++ i) { u64 hsh = 0; for (int j = max(0, i - lgmax); j < i; ++ j) { baga(ans, hp[j + 1][i]); } } }

Compilation message (stderr)

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:61:13: warning: unused variable 'hsh' [-Wunused-variable]
         u64 hsh = 0;
             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...