You are not logged in. Please login at www.codechef.com to post your questions!

×

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"

asked 02 May '18, 18:40

harrypotter0's gravatar image

4★harrypotter0
318110
accept rate: 1%

edited 02 May '18, 18:43

1

The seq should be strictly increasing,secondly consider this case

1 1 1 1

1 5 3 4

(02 May '18, 20:42) vivek_19982996★

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

(02 May '18, 21:43) harrypotter04★

One hint is that think about the removal of elements.

Spoiler below

View Content
link

answered 02 May '18, 23:17

sdssudhu's gravatar image

6★sdssudhu
1.1k310
accept rate: 15%

Got it . Thanks :)

(03 May '18, 10:59) harrypotter04★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2,719
×2,363
×1,110
×1,070
×356

question asked: 02 May '18, 18:40

question was seen: 273 times

last updated: 03 May '18, 10:59