FORGETPW - Editorial

CodeChef: Practical coding for everyone… giving correct for test and tricky cases also 4EA9kD - Online C Compiler & Debugging Tool - Ideone.com but still wrong answer…
can some1 help

Can someone please tell me why I am getting a TLE? I have spent hours on this question but couldn’t do it… It clears all the tricky cases too btw
http://www.codechef.com/viewsolution/4099816

http://www.codechef.com/viewplaintext/4064994

Hey Guys,

I was getting TLE for the above solution, can someone tell what was wrong?
Help would really be appreciated.

Thank You

A small correction, 0. and . themselves hold no meaning, as the question itself suggests that

After all the character replacements, the string is guaranteed to be a positive decimal number.

my all test cases are working properly and have checked each and every possibility of test case that can be possible but it is still showing wrong answer.
Here is my code. please someone go through it and help me out.

#include<stdio.h>
#include<string.h>

int main()
{
int t,n,i,j,a,k,e,d,flag,flag1,b;
char s[1000001],c[127],p[127],m[1000001];
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf(" %c %c",&c[i],&p[i]);
}
scanf("%s",s);
flag=0;
flag1=2;
a=strlen(s);
if(n!=0)
{
for(i=0;i<a;i++)
{
for(j=0;j<n;j++)
if(s[i]==c[j])
{
s[i]=p[j];
break;
}
}
	}
for(i=0;i<=a;i++)
{ if(s[i]>'0' && flag==0)
{
flag=1;
j=i;
}
if(s[i-1]>'0' && s[i]=='0')
k=i-1;
else if(s[i-1]>'0' && s[i]=='\0')
k=i;
if(s[i]=='.' && flag==0)
{ flag1=0;
e=i;
}
if(s[i]=='.' && flag==1)
{ d=i;
flag1=1;
}
}
if(flag1==2)
{
for(i=j;i<a;i++)
m[i-j]=s[i];
}
else if(flag==1 && flag1==1)
{
if(k>d)
for(i=j;i<=k;i++)
m[i-j]=s[i];
else
for(i=j;i<d;i++)
m[i-j]=s[i];
}
else
{
for(i=e;i<=k;i++)
m[i-e]=s[i];
}
if(flag!=1)
printf("0\n");
else
printf("%s\n",m);
b=strlen(m);
for(i=0;i<b;i++)
m[i]='\0';
	for(i=0;i<n;i++)
c[i]='\0';
	for(i=0;i<n;i++)
p[i]='\0';
}

return 0;
}

Check this…It works perfect. Give all the required solution.
But give wrong ans.

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

I am getting Runtime error for my java code.
Can anybody help me with this?

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

http://www.codechef.com/viewsolution/4110336
Can you please tell me for what case does this solution fail because it passes all the tricky cases mentioned here.
Thanks in advance.

we can also used linked list for removing 0

Hi,

My solution is http://www.codechef.com/viewsolution/4079595.My solution passed all the testcases successfully. Can you please help me to find the error with my solution.

hi…I usually code in java…and I referred to the Editorialist’s solution for this problem. With all due respect, I think there is one case where the output’s not valid…

Input:

1

1

z .

343z.89

Output:
343…89

Well, is it or is it not a valid output ?

P.S. : No disrespect to anyone considering I’m just a newbie.

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

hey, guyz … i am new here … my solution is giving right answer for every test case but still WA . plzz can any one tell me my mistake or test case which i am missing … . please help me friends .

1 Like

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…!!