Can anyone help me with A Few Laughing Men from ACM-ICPC Asia-Amritapuri Onsite Replay Contest 2017 ?

Hello friends can someone tell me how to approach this problem ? I am getting WA.

@vijju123 @taran_1407 @vivek_1998299 @meooow @john_smith_3 @aryanc403 @vbt_95

Here is my latest submission. If it’s too messy, here is the approach I used :

for __ in range(readInt()):
n = readInt()
arr = readInts()
brr = readInts()
last,f,count = -1,1,0
for i in range(n):
    if arr[i]==1 and last==-1:
        last = brr[i]
    elif arr[i]==1:
        if last<=brr[i]:
            last = brr[i]
        else:
            count+=1
            if count>1:
                f = 0
                break
if f:
    print "#laughing_arjun"
else:
    print "#itsnot_arjun"

The seq should be strictly increasing,secondly consider this case

1 1 1 1

1 5 3 4

1 Like

But the code is working correctly for the above test case and as far as strictly increasing series is considered I agree with you.

One hint is that think about the removal of elements.

Spoiler below

Click to view

If a[i]<=a[i-1] try removing both ai and ai-1. In case removal of anyone of those gives the solution take the minimum one.

1 Like

Got it . Thanks :slight_smile: