OMR Sheet Processing
OMR Sheet Processing
4
HackerRank | Prepare Certify Compete Apply Search
All Contests Goldman Sachs India Hackathon 2024 [CS] OMR sheet processing
Problem Statement
You are given an image representing a scanned OMR answer sheet. Each image contains a grid of circles, with each row representing
one question and each column representing a possible answer (A, B, C, D). Some circles are filled to indicate the selected answer by
the candidate.
Your task is to write a program that takes the image as input, along with an array containing the correct answers for each question
and returns a score based on the number of correct answers. For each correct answer, score will be incremented by 1 point. Each
question has only 1 correct answer.
The filled circles in the images can be either fully filled (360 degrees filled) or partially filled. A fully filled circle represents a definite
answer, while a partially filled circle represents a probable answer. If a circle is filled more than 75% (270 degrees filled) of the area,
it should be considered as a definite answer.
2. For the below image, where partial circles are filled, when evaluating with expected answer as C D D D, the score is evaluated as 3
https://www.hackerrank.com/contests/gs-india-hackathon-2024/challenges/omr-sheet-processing 1/4
9/29/24, 9:06 AM [CS] OMR sheet processing | Goldman Sachs India Hackathon 2024 Question | Contests | HackerRank
Note
Few things to keep in mind while evaluating the score
A filled circle is considered definite answer when 75% of the circle area is filled, which means 270 degress or more must be filled
to consider it as a definite answer.
If a candidate has marked more than one circle as definite answer for a question, then even if the definite answers contains the
correct answer, no score will be provided for that question.
Input Format
Guidelines
1. First line in the standard input represents the image to be used eg. omr_sheet_1.png
2. Second line in the standard input represents the correct answer for the omr sheet, separated by a space
Sample Input
omr_sheet_1.png
D A D C
Python
//read from standard input filename = input() // get file if os.path.isfile(filename):
# Open the file
with open(filename, 'r') as file:
...
Java
import java.io.File;
...
// read from standard input Scanner scanner = new Scanner(System.in); String query =
scanner.nextLine(); // Get the image file
File file = new File("omr_sheet_1.png");
Constraints
https://www.hackerrank.com/contests/gs-india-hackathon-2024/challenges/omr-sheet-processing 2/4
9/29/24, 9:06 AM [CS] OMR sheet processing | Goldman Sachs India Hackathon 2024 Question | Contests | HackerRank
Image constraints
1. All Image dimensions are 500 x 500
Guidelines
Please output only the score in standard output
Sample Output
3
Sample Input 0
omr_sheet_1.png
D A D C
Sample Output 0
Sample Input 1
omr_sheet_2.png
D A D C
Sample Output 1
Sample Input 2
omr_sheet_6.png
C D D D
Sample Output 2
Submissions: 499
Max Score: 1000
Difficulty: Medium
Python 3 ⚙
1
https://www.hackerrank.com/contests/gs-india-hackathon-2024/challenges/omr-sheet-processing 3/4
9/29/24, 9:06 AM [CS] OMR sheet processing | Goldman Sachs India Hackathon 2024 Question | Contests | HackerRank
Upload Code as File Test against custom input Run Code Submit Code
Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy |
https://www.hackerrank.com/contests/gs-india-hackathon-2024/challenges/omr-sheet-processing 4/4