# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
373694 | morato | Mate (COCI18_mate) | C++17 | 36 ms | 18412 KiB |
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 <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long dp[55][55][26][26], sum[55][55][26]; // sum[sz][x] = soma dos dp[sz][K][x]
long long mod(long long a, long long b) {
a %= b;
if (a < 0) a += b;
return a;
}
void add_self(long long& a, long long b) {
a = mod(a + b, MOD);
}
/*
dp[ t ][ x ][ y ] = numero de sequencias de tamanho t ate r que terminam em xy
calculo pra cada r ^ e somo em sum[ t ][ x ][ y ]
*/
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string str; cin >> str;
int n = (int) str.size();
dp[0][0][0][0] = sum[0][0][0] = 1;
for (int r = 0; r < n; r++) {
// vou adicionar o str[r] para buildar um novo bloco
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |