Cod sursa(job #1010463)

Utilizator alex_HarryBabalau Alexandru alex_Harry Data 14 octombrie 2013 22:39:48
Problema PScPld Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.96 kb
#include<fstream>
#include<cstring>
#define NMax 20050
using namespace std;
char s[NMax];
long long N, Sol;
void Read()
{
    ifstream fin("pscpld.in");
    fin.getline(s+1, NMax);
    N=strlen(s+1);
}
int Expand (int Left, int Right)
{
    int Length=0;
    while (Left>0 and Right<=N and X[Left]==X[Right])
    {
        --Left, ++Right, ++Length;
    }
    return Length;
}
void Solve()
{
    void SolveUneven ()
{
    int P=0, R=0;
    for (int i=1; i<=N; ++i)
    {
        int Left, Right;
        if (R>=i)
        {
            DP[i]=min (DP[P-(i-P)], R-i);
        }
        Left=i-DP[i];
        Right=i+DP[i];
        DP[i]+=Expand (Left, Right);
        if (i+DP[i]>R)
        {
            P=i;
            R=i+DP[i];
        }
        S+=((long long)DP[i]);
    }
}
}
void Print()
{
    ofstream fout("pscpld.out");
    fout<<Sol<<endl;
}


int main()
{
    Read();
    Solve();
    Print();
    return 0;
}