why W/A DCP-33: Catch Me If You Can

Dev Skill archived problems can be discussed here.

why W/A DCP-33: Catch Me If You Can

by joy25896 » Tue Mar 28, 2017 10:27 pm

removed after accepted.... :mrgreen:
Last edited by joy25896 on Sun Apr 02, 2017 2:44 am, edited 1 time in total.
 
Posts: 30
Joined: Wed Nov 16, 2016 3:29 pm
Location: dhaka bangladesh

Re: why W/A DCP-33: Catch Me If You Can

by mahrahat » Thu Mar 30, 2017 10:46 am

First, if d is 0, then v1 and v2 have no role; only T will determine result.

Second, Abir will survive if sum>=sum1, not sum>sum1.

Third, instead of
Code: Select all
for(int i=1;i<t;i++)
{
    sum1+=v1;
    sum2+=v2;
}

you could have written,
Code: Select all
sum1 = v1*t;
sum2 = v2*t;


Fourth, have you checked this?
Lets
• search through previous topics before posting a new topic
• include link to problem (or at least problem number)
• write code snippets inside [code] [ /code] tags
 
Posts: 48
Joined: Thu Nov 24, 2016 9:11 pm
Location: Bangladesh

Re: why W/A DCP-33: Catch Me If You Can

by joy25896 » Fri Mar 31, 2017 1:49 am

Removed after accepted.... :D
Last edited by joy25896 on Sun Apr 02, 2017 2:43 am, edited 1 time in total.
 
Posts: 30
Joined: Wed Nov 16, 2016 3:29 pm
Location: dhaka bangladesh

Re: why W/A DCP-33: Catch Me If You Can

by mahrahat » Fri Mar 31, 2017 3:50 pm

Try this I/O:

Input:
Code: Select all
4
2 1 0 0
2 1 0 1
1 2 0 0
1 2 0 1


Expected output:
Code: Select all
Case 1: Abir will survive
Case 2: Abir will be arrested
Case 3: Abir will survive
Case 4: Abir will be arrested


Your output:
Code: Select all
Case 1: Abir will survive
Case 2: Abir will be arrested
Case 3: Abir will survive
Case 4: Abir will survive


Reason:
First, if d is 0, then v1 and v2 have no role; only T will determine result.


Solution:
Remove v1==v2 && from your code.

Let us know if there is any more problem.
Lets
• search through previous topics before posting a new topic
• include link to problem (or at least problem number)
• write code snippets inside [code] [ /code] tags
 
Posts: 48
Joined: Thu Nov 24, 2016 9:11 pm
Location: Bangladesh

Re: why W/A DCP-33: Catch Me If You Can

by joy25896 » Sun Apr 02, 2017 2:42 am

tnx vaiya
 
Posts: 30
Joined: Wed Nov 16, 2016 3:29 pm
Location: dhaka bangladesh


Who is online
Users browsing this forum: No registered users and 1 guest
cron