Cod sursa(job #2942043)

Utilizator TghicaGhica Tudor Tghica Data 18 noiembrie 2022 20:07:38
Problema PScPld Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.91 kb
#include <fstream>
#include <algorithm>

using namespace std;

ifstream cin("pscpld.in");
ofstream cout("pscpld.out");

int t[2000001];

signed main() {
  string s;
  char ch;
  int i, drmax, curCenter, lung, rez;
  drmax = 0;
  curCenter = 0;
  while(cin>>ch) {
    s = s + '#' + ch;
  }
  s = s + '#';
  lung = s.size() - 1;
  /*for (i = 1; i <= lung; i++) {
    if (i <= curCenter + t[curCenter]) {
      t[i] = min(t[2 * curCenter - i], curCenter + t[curCenter] - i);
    }
    else {
      t[0] = 0;
    }
    while (i + t[i] + 1 <= lung && i - t[i] - 1 >= 0 && s[i - t[i] - 1] == s[i + t[i] + 1]) {
      t[i]++;
    }
    if (i + t[i] > curCenter + t[curCenter]) {
      curCenter = i;
    }
  }
  rez = 0;
  for (i = 1; i <= lung; i++) {
    if (i % 2 == 1) {
     rez = rez + t[i] / 2 + 1;
    }
    else {
      rez = rez + t[i] / 2;
    }
  }*/
  cout << rez;
  return 0;
}