ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1989. Subpalindromes

RainGrid Help. [7] // Problem 1989. Subpalindromes 19 Oct 2013 14:33
I cant understand my mistake for WA2. I tried it on my PC. Its work.

Edited by author 19.10.2013 14:34
wintowanti Re: Help. [6] // Problem 1989. Subpalindromes 19 Oct 2013 16:22
can you post your code?
RainGrid wrote 19 October 2013 14:33
I cant understand my mistake for WA2. I tried it on my PC. Its work.

Edited by author 19.10.2013 14:34
RainGrid Re: Help. // Problem 1989. Subpalindromes 19 Oct 2013 16:23


Edited by author 19.10.2013 16:29
RainGrid Re: Help. // Problem 1989. Subpalindromes 19 Oct 2013 16:25


Edited by author 19.10.2013 16:28
RainGrid Re: Help. [3] // Problem 1989. Subpalindromes 19 Oct 2013 16:35
var
    s,s1,s2: string;
    i,f,n,m,k,l,p,j,code: longint;
    ch:char;
begin
    readln(s);
    readln(n);
    for i:=1 to n do
    begin
        readln(s2);
        if s2[1]='p' then
        begin
             Val(s2[13],j,code);
             Val(s2[15],k,code);
             s1:=copy(s,j,k-j+1);
             f := 0;
             for  p:= 1 to length(s1) div 2 do
             if s1[p] <> s1[length(s1)-p+1] then
             begin
                  writeln('No');
                  f := 1;
             end;
             if f = 0 then
             writeln('Yes');
        end else
        begin
             Val(s2[8],m,code);
             ch:=s2[10];
             delete(s,m,1);
             insert(ch, s,m);
        end;
    end;
end.
Tolstobrov Anatoliy[Ivanovo SPU] Re: Help. // Problem 1989. Subpalindromes 19 Oct 2013 20:53
Maybe multiple No's? But you will take TLE.
Tolstobrov Anatoliy[Ivanovo SPU] Re: Help. [1] // Problem 1989. Subpalindromes 19 Oct 2013 20:59
Try this test:

aacdeabcdeabcdeabcde
1
palindrome? 1 20
RainGrid Re: Help. // Problem 1989. Subpalindromes 20 Oct 2013 01:31
thx.