Corner Cases in "Coloring the Grid" (Oct LunchT 2018)??

Coloring the grid (LTIME65B)

Can some help me in finding whats going wrong with my logic for the above question

it gaved AC for sub task-1 but went wrong for the last testcase of the sub task-2

My Solution : https://www.codechef.com/LTIME65B/status/CLORGIRD,tushar2899

for those who are unable to access:


num1=int(input())
for _ in range(num1):
    num2=map(int,raw_input().strip().split())
    k=[]
    for j in range(num2[0]):
        l=raw_input()
        k.append(l)
    pri=0
    for i in range(num2[0]):
        temp=0
        for layer in k[i]:
            if layer=='#' and temp==1:
                pri=1
                break
            elif layer=='.':
                temp+=1
            else:
                temp=0
        if temp==1 or pri==1:
            pri=1
            break
    if pri==0:
        for stand in range(num2[1]):
            temp=0
            for ls in range(num2[0]):
                if k[ls][stand]=='#' and temp==1:
                    pri=1
                    break
                elif k[ls][stand]=='.':
                    temp+=1
                else:
                    temp=0
            if temp==1 or pri==1:
                pri=1
                break
        if pri==0:
            print "YES"
        else:
            print "NO"
    else:
        print "NO"
                
</pre>

Consider this case:

5 5

“…”

“…”

“…#…”

“#…”

“##…”

Consider the case ignoring “” (quotation marks)

You cannot color row =4 column =2 in the above case

1 Like

yes, got it thankyou.

//