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

see this my solution using substr func (after contest) → CodeChef: Practical coding for everyone

1 Like

bhai…there are sites where all languages have same time limit.
codechef atleast has 5X for python.
if u are using python from so long…then u should know when it works
and when to use c++.

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