FORGETPW - Editorial

Why does this get tle?

FORGETPW my solution

Is there any way to find out which test case a solution failed on? This was a pretty straight forward implementation but it got WA. http://www.codechef.com/viewsolution/4081801

Please help.Tried every possible case mentioned here.Still getting WA.

http://www.codechef.com/viewsolution/4114405

1 Like

All the sample test cases are passing. Also the corner case of “.”. However it is still giving wrong answer. Could somebody help?
http://www.codechef.com/viewsolution/4108137

1 Like

this is my solution. can anybody tell me what’s wrong with this solution. it passed all tricky test cases but still showing wrong answer.
http://www.codechef.com/viewsolution/4119925

My code works fine for all the input cases, I also tried my code with the tricky cases mentioned in the editorial but i am still getting WA. Can anyone please explain to me what the problem is.


[1]


  [1]: http://www.codechef.com/viewsolution/4120495

I’m getting a correct answer for every corner case, for every cases I read in the comments, yet getting a WA.


[1]
Can someone help me to tell where is it that I am going wrong?


  [1]: http://www.codechef.com/viewsolution/4123826

getting WA after trying several test cases… CodeChef: Practical coding for everyone …can someone help…!!

I am getting all test cases correct on my system still it is giving wrong answer …please suggest what i am doing wrong…
CodeChef: Practical coding for everyone

I’m just doing these for practice, but its really hard to call “.” a “positive decimal number”. Arguably its also hard to call “0” and “0.0” as a “positive decimal number” (“non-negative decimal number” would have been more appropriate), but I don’t think that “.” passes as a “positive decimal number” in any culture I’m aware of.

plz can anyone point out the error… 5l8Jy2 - Online C Compiler & Debugging Tool - Ideone.com
i spent lot of time over it…(>_<)

@m1sterzer0 after reading your answer above…out of curiosity i checked your submission for the problem… i dont know why its giving the wrong output instead of being accepted as right answer z1YyRR - Online C++ Compiler & Debugging Tool - Ideone.com

http://www.codechef.com/viewsolution/3999376
This is my solution it is passing every case mentioned in the problem and every corner case as well. What is the problem here?

I am getting wrong answer error… please help…

#include < iostream>
#include < string>

using namespace std;

int main()
{

int n;
cin>>n;
string  enPass,Pass;
while(n>0)
{
    int r,counter=0;
    cin>>r;   //  no. of rules.
    char c[r],p[r];
    for(int i=0;i<r;i++)
    {
        cin>>c[i]>>p[i];  // taking each rule as input
    }
    cin>>enPass;  // taking encrypted password as input
    Pass = enPass;
    for(int j=0;j<enPass.size();j++)
    {
        for(int s=0;s<r;s++)
        {
            if(c[s] == enPass[j])
            {
                Pass[j] = p[s];
            }
            
        }
    }    
    
    int str_Size = Pass.size();
    for(int q = str_Size-1; q >= 0; q--)
    {
        if(Pass[q] == '0') Pass.erase(q);
        else if(Pass[q] == '.')
        {
            Pass.erase(q);
            break;
        }
        else break;
    }

   for(int t=0;t<str_Size;t++)
    {
        if(Pass[t] == '0') counter++;
        else break;
    }
   Pass.erase(0,counter);
    cout<<Pass<<"\n";
    n--;
}
return 0;

}

I cracked this after trying different print techniques for the output.
First, I print the op as separate characters(i.e every single S[i] using loop). This didn’t work out. Secondly, I print the op as integers(using S[i]-‘0’ except for ‘.’). This didn’t work out as well. Finally after going through the solution of @pummy02(CodeChef: Practical coding for everyone) I got a hint. I assigned the 'last+1’th char as null and printed the op as a string. This worked out!

Can somebody help me with this solution, this gives correct answer for all the given tc but on submission gives wa.
https://www.codechef.com/viewsolution/14346300

@ar7thecoder you could have wrote it better. you are calculating leading and trailing zeroes for every string element which will give you a TLE. you can first decrypt the string and then calculate leading and trailing zeroes for the whole decrypted string. hope you get it now :slight_smile:

1 1 k l books not working for this test case, your code

did the test cases include many mappings to ‘.’ ??

1 Like

Shortest representation of 000.000 should be 0. Empty string can not be a valid representation.

1 Like