hiho week 60 register

Ended

Participants:587

Verdict:Accepted
Score:100 / 100
Submitted:2015-08-23 22:01:40

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
const int MAX_LEN = 2100;
int main() {
    string A, B;
    cin >> A >> B;
    int n = A.length();
    int m = B.length();
    int dp[MAX_LEN][MAX_LEN][2], f[MAX_LEN][MAX_LEN];
    memset(dp, 0, sizeof(dp));
    memset(f, 0, sizeof(f));
    //preprocessing
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (A[i-1] == B[j-1]) {
                f[i][j] = f[i - 1][j - 1] + 1;
            }
            else {
                f[i][j] = 0;
            }
        }
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX