Week testcase in PERCAPTA, June Cookoff 2020

I found many submission of PERCAPTA questions asked in June Cookoff, have calculated per capita income using float(see testcase written below for more clarity).

One of the submission, it has passed all the testcases,

https://www.codechef.com/viewsolution/34619148

Here is mine testcases for which it is giving wrong ans.
1
2 1
99998 99999
10 10
1 2

Output should-> 1 2
But submitted solution is giving-> 2 1 2

They should re-evaluate this question by adding theses corner testcases.

Here is another one with same fault,
https://www.codechef.com/viewsolution/34617586

The output should be 1 2. As we will select only node 2 (with the highest per cap income ). Why it is 1 1 ?

3 Likes

same question. :thinking: @nikiitp18

This is so wrong in last cook off some string question has very weak TC and now in this :frowning_face:

1 Like

They have weak tc for even MEX problem

Now, I think Codechef should also have 12 hours or may be less time for hacking phase

3 Likes

1
2 1
99998 99999
10 10
1 2
for this,
the answer should be :
1
2
and
not 1 1

Ya output should be 1 2 not 1 1, it was a silly mistake :sweat_smile:. But the matter is that these submission are giving wrong output, we should demand for re-evaluation.

u r ri8, it was a mistake :sweat_smile:. But these submission are giving wrong output, what do u think about that @nehal_21 ?

I think you should also leave a mail at help@codechef.com, it’ll be taken into consideration much earlier. Also all the submissions should also be re-evaluated in that case :neutral_face:.

Yes you are right. They should reevalute all the submission.

yes …

Actually the thing is that I didn’t participated in the contest. So, if someone from you can copy paste this in ur mail that would be great for all u.

Sounds good.

regrading PERCAPTA
someone plz help me out that …plz
why am i getting RE?
its working for sample input and some random inputs i tried .

my solution: CodeChef: Practical coding for everyone
and solution is below:
import collections

def dfs(p):
  
    visited.add(p)
    temp.add(p+1)
    for node in road[p]:
        if(node not in visited and selected[node]):
            
            dfs(node)
    
t=int(input())
for _ in range(t):
    n,m=map(int,input().split())
    income=list(map(int,input().split()))
    pop=list(map(int,input().split()))
    road=collections.defaultdict(list)
    for __ in range(m):
        a,b=map(int,input().split())
        road[a-1].append(b-1)
        road[b-1].append(a-1)
    i=income[0]
    p=pop[0]
    # to find max per capita
    for x in range(1,n):
        if(i*pop[x]<p*income[x]):
            i=income[x]
            p=pop[x]
    
    
    selected=[False]*n
    # to select node with max per capita
    for x in range(n):
        if(pop[x]*i== income[x]*p):
            selected[x]=True
    
    visited=set()
    ans=set()
    
    for each in range(n):
        
        if(each not in visited and selected[each]):
            temp=set()
            dfs(each)
            if(len(temp)>len(ans)):
                ans=temp
    print(len(ans))
    print(*ans)

@ssrivastava990 @anon24245385 @sebastian @mahatejvarma @ashish_kaur @nikiitp18 @

Can @rezwanarefin01 have a look at this