Byang's Day Out!

Limits: 5s, 512 MB

Byang and his little brother Kuno loves Cricket. But they never went to the stadium to watch a match live, happening in front of them! So now is their time to watch a game from the Eastern Stand of Mirpur Sher-E-Bangla Stadium. They have spent 18 hours in the queue (yes, 18 hours) to manage two tickets. But there’s a little problem, and we jump right in to help them.


This is a companion discussion topic for the original entry at https://toph.co/p/byangs-day-out

amr (python3)code tiktak vhabe kaj kortese. kintu bar bar 3rd running e (cpu limit exceeded) dekasse. Ami amr code jotota sombob simple reke onk way they try koresi. still same problem… apni ki bolte parben (cpu limit exceeded chara python3 diye solve kora possible kina) kisu hint and tips dile valo hy! TIA

Look at my code :slight_smile:
Source Bruteforce 1.c (393B)

C

#include <stdio.h>
int main ()
{
    int i,a,b,c;
    long long int t ;

    scanf ("%lld",&t);

    for (i=1;i<=t;i++)
    {
        scanf ("%d %d %d",&a,&b,&c);

        if (a>0 && b>0 && c>0 && a<101 && b < 101 && c < 101 ) {

        if (a+b>=c && a+c>=b && b+c>=a)
            printf ("Yes");
        else
            printf ("No");
        }
    }
    return 0 ;

every time my answer is being accepted in the first 2 test cases … But on the 3rd test case , it is showing wrong answer

You need to print a newline character after every test case. The statement says:

print a line saying “Yes” … [or] … “No”.

Your code is printing all of the Yes/No in the same line.

Thanks , brother . I’ve just found out that and solved the problem after 7 unsuccessful attempts … Thanks

1 Like
testNo = int(input())

m = 0	
while m < testNo:
	seq = input().split()
	i = 0
	while i < len(seq):
		seq[i] = int(seq[i])
		i = i+1
	def is_possible():
		j = 0
		k = 1
		l = 2
		while j < len(seq):
			while k < len(seq):
				sum = seq[j] + seq[k]
				k = k+1
				if sum != seq[l] and sum < seq[l]:
					return "No"
			j = j+1


	if is_possible() == "No":
		print(is_possible())
	else:
		print("Yes")
	m = m+1

why is this producing wrong answer on the third case? Please someone help me

Please tell me why my answer is producing WA:
T=int(input())
for i in range(T):
a,b,c=map(int,input().split())
x=a+b
y=b+c
z=a+c
if x>c and y>a and z>b:
print(‘Yes’)
else:
print(‘No’)

just use >= instead of > and replace the line " for i in range(T) " with this line “for i in range(1,T+1)”

1 Like

No worries, I solved it way long ago

1 Like

#include <stdio.h>

int main() {
int a,v,b,c;
scanf("%d",&v);
if(v<=1000000){
for(int i=0;i<=v;i++){
scanf("%d %d %d",&a,&b,&c);
if(a+b+c<=100){
if(a+b>=c&&a+c>=b&&b+c>=a){
printf(“Yes\n”);
break;
}else {
printf(“No\n”);
break;
}}}
}
return 0;
}what Wring here? It says 3rd case error