Brute Force passed in (Chef, Chefina and Their Friendship)

I mean yea, In such a scenario nothing would be fair lol

What did I do wrong then? :sob:
Is there any slight modification that will help me get it accepted or should I entirely change my approach?

Inbuilt functions are optimised. Thats why they are generally faster.

i m nt using pythonā€¦and i dont think python has ā€œ5xā€ time limit eitherā€¦

I donā€™t think anything should be done now. I in fact did not submit thinking O(n*n) would not pass. Only thing is that from future they should take care of test cases.

1 Like

Now will they make the contest unrated or re-evaluate all the solutions and update the rating?

1 Like

Nothing hppen gonna bro chill and do coding :slight_smile:

@admin Rejudge the solutions. Itā€™s unfair for people who beleived the cases to be strong.

1 Like

Not Possible ā€¦ rating updated :slight_smile:

:frowning:

Chill man Rating hi to h :slight_smile:

@admin At least answer the question even if you canā€™t do anything now.

The official replies are here:

Apologies again for the issue.

4 Likes

can you please whcek why TLE issue coming in this code

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be ā€œMainā€ only if the class is public. */
class Codechef{

public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
while(T-->0)
{	

	String s=sc.next();
	
	int n=s.length();
	int count=0;
	String s1="",s2="",s3="",s4="";
	
	for(int i=2;i<(n-2);i+=2)
	{
		s1=s.substring(0,i/2);
		s2=s.substring(i/2,i);
	//	System.out.println("ii:"+ii);
		if(s1.equals(s2))
		{
		s3=s.substring(i,i+ (n-i)/2);
		
		s4=s.substring(i+(n-i)/2,n);
		if(s3.equals(s4))
			count++;
		}
	}
	
	System.out.println(count);
}
}

}

@admin

still i am getting TLE issue

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be ā€œMainā€ only if the class is public. */
class Codechef{

public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
while(T-->0)
{	

	String s=sc.next();
	
	int n=s.length();
	int count=0;
	String s1="",s2="",s3="",s4="";
	
	for(int i=2;i<(n-2);i+=2)
	{
		s1=s.substring(0,i/2);
		s2=s.substring(i/2,i);
	//	System.out.println("ii:"+ii);
		if(s1.equals(s2))
		{
		s3=s.substring(i,i+ (n-i)/2);
		
		s4=s.substring(i+(n-i)/2,n);
		if(s3.equals(s4))
			count++;
		}
	}
	
	System.out.println(count);
}
}

}

@ssrivastava990 can you please check my code and tell what if the issue as @admin said they have updated test cases but still TLE issue is there

Refer to this:

1 Like

Brute force wil not work now Test cases are updated :slight_smile:

1 Like