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 1102. Strange Dialog

Can I use Pascal and DP to get AC?If possible,how?If impossible how?
Posted by CO2 17 Jul 2004 14:38
If I use Pascal,I found the "read" takes too long time.In C,we can use "getc".But in pascal,I don't know how to do.
Is there any algo better than Dp? What does DFA meant?
Could you give me some hint or a good algo?
Thanks for your help.
Waiting for RE.
I solved it reading char by char in 0.578 secs. I think, your DP is too slow. Check $I directive.
Posted by Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 17 Jul 2004 16:32
Re: What does DFA meant?
Posted by BYF 30 Aug 2004 16:20
就是有限状态自动机。
Nor can I solve it by Dp.
Posted by IceWorld 7 Mar 2005 13:50
const
    Inf         ='';
    Outf        ='';
    max            =10;
var
    n            :integer;

Procedure main;
var
    i,j,k       :integer;
    s,bool      :string[max+2];
    alp            :set of char;
    c            :char;
begin
    assign(input,Inf); reset(inpuT);
    assign(output,Outf); rewrite(output);
    readln(n);
    alp:=['p','u','t','o','i','n','e'];
    for i:=1 to n do
    begin
        k:=0;
        s:='';
        bool:='1';
        while not(eoln) do
        begin
            if length(s)>max then begin delete(s,1,1); delete(bool,1,1); end;
            read(c);
            if not(c in alp) then begin bool:='0'; break; end;
            s:=s+c;
            if (c='n') and (length(s)>1) then if (copy(s,length(s)-1,2)='in') and (bool[length(bool)-1]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='n') and (length(s)>4) then if (copy(s,length(s)-4,5)='puton') and (bool[length(bool)-4]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='t') and (length(s)>2) then if (copy(s,length(s)-2,3)='out') and (bool[length(bool)-2]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='t') and (length(s)>4) then if (copy(s,length(s)-4,5)='input') and (bool[length(bool)-4]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='t') and (length(s)>5) then if (copy(s,length(s)-5,6)='output') and (bool[length(bool)-5]='1')
                then begin bool:=bool+'1'; continue end;
            if (c='e') and (length(s)>2) then if (copy(s,length(s)-2,3)='one') and (bool[length(bool)-2]='1')
                then begin bool:=bool+'1'; continue end;
            bool:=bool+'0';
        end;
        if bool[length(bool)]='1' then writeln('YES')
        else writeln('NO');
        readln(s);
    end;
    close(output);
    close(Input);
end;

begin
    main;
end.
CO2 wrote 17 July 2004 14:38
If I use Pascal,I found the "read" takes too long time.In C,we can use "getc".But in pascal,I don't know how to do.
Is there any algo better than Dp? What does DFA meant?
Could you give me some hint or a good algo?
Thanks for your help.
Waiting for RE.
Using strings makes it too slow...
Posted by Ves 8 Mar 2005 05:34
Re: What does DFA meant?
Posted by ronobe (aka oberon) 8 Mar 2005 17:54
I suppose that this means Deterministic Finite Automat.

> 就是有限状态自动机。
Ну шо тебе ответить
Re: What does DFA meant?
Posted by lengyue2005 8 Jun 2005 13:58
ER~ I'M CHINESE TOO .BUT I DON'T KNOW WHAT DOES "有限状态自动机"MEAN.CAN YOU SAY MORE ABOUT IT??
Re: Can I use Pascal and DP to get AC?If possible,how?If impossible how?
Posted by Yu Yuanming 8 Jun 2005 17:19
Of course Pascal is OK.
I got AC simply use "read"

DP isn't a good way in this problem,I think.
You can go to  oibh.ioiforum.org  to find some useful tips.