Help me in solving WATERFILLING problem

My issue

My code

# cook your dish here
t= int(input())
for i in range (t):
    if (B1==0 and B2==0) or(B1==0 and B3==0)or(B2==0 and B1==0)or(B2==0 and B3==0)or(B3==0 and B1==0)or(B3==0 and B2==0):
        print("Water filling time")
        print("Not now")

Problem Link: WATERFILLING Problem - CodeChef

Hi my old friend :smile:. The condition you have given is correct but you gave one condition 2 times for example you checked
(B1==0 and B3==0) or (B3==0 and B1==0) … If you write any of them the code will still work . My code is working and i put this in my code
(B1==1 and B2==1) or (B2==1 and B3==1) or (B1==1 and B3==1):

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;


  • SuhailSharieff
    public class SuhailSharieff {

    public static void main(String args) {
    Scanner sc=new Scanner(;
    int t=sc.nextInt();
    for (int i = 0; i < t; i++) {
    Listli=new ArrayList<>();
    int x=sc.nextInt();
    int z=sc.nextInt();
    int y=sc.nextInt();
    int fre=Collections.frequency(li, 1);
    if(fre>=2){System.out.println(“Not now”);}
    System.out.println(“Water filling time”);