DCP 114 - Triples [ Need Some Critical Tests ]

Dev Skill archived problems can be discussed here.

DCP 114 - Triples [ Need Some Critical Tests ]

by ssavi » Fri Oct 28, 2016 12:53 am

I Am getting Wrong Answer in this Problem.

Problem: http://devskill.com/CodingProblems/ViewProblem/114

Here is My Code: http://ideone.com/KHS8R6

I tried Several Cases... Like:

Code: Select all
10
5
2 4 6 8 10
4
5 2 3 7
9
1 3 3 5 2 4 6 6 6
10
1 3 3 3 5 2 4 6 6 6
5
0 1 1 2 0
6
0 0 1 1 2 0
5
1 1 2 2 3
6
1 1 2 2 3 4
5
0 0 0 0 0
6
0 1 0 1 0 2




For those Cases I have the following outputs:

Code: Select all
Case 1: 4
Case 2: 2
Case 3: 7
Case 4: 7
Case 5: 2
Case 6: 3
Case 7: 2
Case 8: 4
Case 9: 1
Case 10: 3



Are the outputs Correct ? If not then which one is incorrect? If correct then please give me some critical tests....
 
Posts: 4
Joined: Mon Oct 24, 2016 11:57 am
Location: Comilla University , Comilla

Re: DCP 114 - Triples [ Need Some Critical Tests ]

by ahqmrf » Fri Oct 28, 2016 2:53 am

First of all, I have seen a lot of submissions for this problem. I think most of the submissions are based on wrong solutions because I think most of the users have misinterpreted the problem statement. A triple {p, q, r} comprises of the indices p, q, and r where p ≠ q ≠ r and (1 ≤ p, q, r ≤ N). The problem asks for the number of distinct triples of indices, not elements. And also {p, q, r}, {p, r, q}, {q, r, p} etc. are considered as same triple because only the order of p, q, r changed, not their values. Two triples will be distinct only when there will be at least one member which will be in one triple but not in the other. For example {3, 8, 9}, {9, 3, 8}, {3, 9, 8} etc. are same triples whereas {3, 8, 9 } and {8, 9, 10} are not.

After going through your code, it is clear that you have misinterpreted the description. Please go through the description again, then try to find what approach may lead you to pass your code within the time limit. Happy coding! :)
 
Posts: 3
Joined: Wed Oct 26, 2016 12:50 am

Re: DCP 114 - Triples [ Need Some Critical Tests ]

by ssavi » Fri Oct 28, 2016 8:53 am

You should Clear it in the Statement using some example or Notes below ( as the CF does )
 
Posts: 4
Joined: Mon Oct 24, 2016 11:57 am
Location: Comilla University , Comilla

Re: DCP 114 - Triples [ Need Some Critical Tests ]

by ahqmrf » Fri Oct 28, 2016 7:07 pm

The problem itself has clear statement which doesn't need this much clarification. :)
 
Posts: 3
Joined: Wed Oct 26, 2016 12:50 am


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