Update appNew update is available. Click here to update.
sidenav-btnClose
Topic list
Market Survey
MEDIUM
Matrices (2D Arrays)
Topics (Covered in this problem)
Problem solved
Badge
Skill meter
Matrices (2D Arrays)
-
-
Other topics
Problem solved
Badge
Skill meter
Strings
-
-
Linked List
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
userLevel
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Market Survey

Contributed by
TanishkTonk
Medium
yellow-spark
0/80
Share
0 upvotes

Problem Statement

Right Answer: For a particular question, the highly chosen option till that point in time is treated as the correct answer. If multiple options have the exact count, then out of those options, the one which was chosen recently is treated as the correct answer.

Score of a Participant: One point will be awarded for each correct answer. No negative points for wrong answers.

Instant Result: This is shared with the Participant instantly after completing his/her exam. (this is equal to the number of correct answers)

Final Result: Only the final top scorer(TOPPER) is announced along with his score.

Note:
At the end of all M Participants completing the exam, the final correct answers get decided.
Based on these answers score of each candidate gets recalculated, and the one with the highest score is the TOPPER!!!
If more than one Participant gets the top score, then the one who attempted the exam first is treated as TOPPER.
Detailed explanation ( Input/output format, Notes, Constraints, Images )
Sample Input 1 :
2
10 2
1 2 3 4 1 2 3 4 1 2
1 2 4 4 3 2 3 1 1 3
2 3 4 4 1 2 3 1 1 2
4 3
1 2 3 4
2 1 4 3
4 1 2 3
1 3 2 1
Sample Output 1 :
6 6 
1
0 2 0 
1
Explanation For Sample Input 1 :
For First Case - 

Number of questions = 10
Number of Participants = 2
Default answers : 1 2 3 4 1 2 3 4 1 2
(Latest Key is same as Default answers)
First Participant answers : 1 2 4 4 3 2 3 1 1 3
Right answers : 6 (= Instant result of first Participant)
Latest Key : 1 2 4 4 3 2 3 1 1 3
Second Participant’s answers : 2 3 4 4 1 2 3 1 1 2
Right answers : 6 (= Instant result of second Participant)
Latest Key : 1 2 4 4 1 2 3 1 1 2
Final key : 1 2 4 4 1 2 3 1 1 2
(Final Key is same as Latest Key at the end of all Participants completing the exam)
Right answers of Participant1 = Right answers of Participant2 = 8.
So topper is the first Participant with a score of 8.

For the second case - 

Number of questions = 4
Number of Participants = 3
Default answers : 1 2 3 4
(Latest Key is same as Default answers)
First Participant answers : 2 1 4 3
Right answers : 0 (= Instant result of first Participant)
Latest Key : 2 1 4 3
Second Participant’s answers : 4 1 2 3
We will continue similarly and get instant answers for all participants and find the TOPPER.
Sample Input 2 :
2
2 2
2 1
1 3
1 2
4 1
4 2 2 1
3 0 1 1
Sample Output 2 :
0 1 
1
1 
1
Reset Code
Full screen
Auto
copy-code
Console