0% found this document useful (0 votes)
7 views1 page

Lab 0 Q2

The document outlines a coding assignment for a game where players guess a target word based on feedback from their attempts, represented by color codes. It details the rules for determining the validity of sequences of attempts and provides input/output formats along with sample inputs and outputs. Additionally, it includes grading information and a request for regrading the assignment.

Uploaded by

Arjun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Lab 0 Q2

The document outlines a coding assignment for a game where players guess a target word based on feedback from their attempts, represented by color codes. It details the rules for determining the validity of sequences of attempts and provides input/output formats along with sample inputs and outputs. Additionally, it includes grading information and a request for regrading the assignment.

Uploaded by

Arjun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

 Prutor ESC101  CodeBook ✏ Practice  Scratchpad ✉  YASH JAISWAL

 My CodeBook

Practice
 2024FALL_ESC111_LAB4_ALL_PRAC #380066
 MacLaren-s Wisdom
 LAB1_ESC112_2023/24-II WORDMANIA
 Possibilities
2024FALL_ESC112_WEEK0
 LAB1_ESC112_2023/24-II_PRAC
 Anagram Madness
PROBLEM STATEMENT
 LAB2_ESC112_2023/24-II_PRAC
 Balancing the strings You are playing a game where you have to guess a target word made up of m characters. You have some
number of attempts and in each of the attempt, you guess the word.
 Where to sit
The result of your guess is given in the form a m-sized color array. The rules of getting the result array are
 PRACTICE-3_25_04_22
defined below.
 Pretty Triangles If you have the right letter in the right spot, it shows up green. A correct letter in the wrong spot shows up yellow.
 PRACTICE-LAB_1_2_31_05_22 A letter that isn't in the word in any spot shows up gray.
 An Odd Problem For example, let's say the word of the day is MANGO and your guess is MHARV. So the colors in this case will
be Green, Gray, Yellow, Gray, Gray. Clearly, green occurences are the easiest to deal with. In order for a position
 PRACTICE-LAB_1_31_05_22
to be green, the characters in the two strings at that position have to be strictly equal. Now, removing those
 Quad Equation
green occurences, in case the occurences of some character is more in your guess (say y) than the occurences
 PRACTICE-LAB_2_31_05_22 in original string (say x), only the first x occurences will be colored yellow. Rest all will be colored gray. For
 Avisi Sequence example considering the same example of MANGO, if your guess is MHAYA, only the third place (the first
 SUM-OF-ODD-DIGIT occurence of 'A') will be colored yellow, and the last place will be colored gray.

 PRACTICE-LAB_3_31_05_22
 A Matrix Problem
You will be given integers n and m, denoting the number of attempts by the user and the length of word
respectively. You are also given the the n attempts of the user and then the target word, which is again of m
Events characters.
Consider two attempts a_i and a_j of a user. The ordered pair (a_i, a_j) form a valid sequence of attempts if the
(Labs/Exams/Quizzes) following condition holds:
1. Any place which was green in the previous attempt should remain green in the next attempt.
LEGEND 2. For every character, Ignoring the green places in a_i, the number of its occurrences which are either yellow or
 CODE SUBMITTED green in a_j should be greater than or equal to the count of its yellow occurences in the previous attempt a_i.
− CODE NOT SUBMITTED

 Exam_ESC112_Fr
Given these n attempts and the target word, you have to find the number of distinct 3-tuples (a_i, a_j, a_k) where
 Exam_Fri
(a_i, a_j) form a valid sequence as well as (a_j, a_k) form a valid sequence. And then you have to output how
 Lab0_ESC112_Fri
many times the attempts given in the input can come at the first place of those 3-tuple valid sequences.
 Q1 (Reward for the effort) Please note that a_k does not need to be the target word. The 3-tuple sequence can be any 3 attempts which
 Q2 (WORDMANIA) are pair wise valid.
 Lab0_Fri
 Lab1_ESC112_Fri
Input format:
 Lab1_Fri
The first line contains two integers n and m, denoting the number of attempts and the length of the word
 Lab2_ESC112_Fri respectively. The next n lines contain a m-length word, representing the attempts. The last line contains another
 Lab2_Fri m-length word, which is the word of the day. You can safely assume that all the attempts as well as the target
 Lab3_ESC112_Fri word will only contain lowercase English letters.

 Lab3_Fri
Output format:
 Lab4_Fri
The only line of output will contain n integers, which is the answer for each of the attempt.
 Lab5_Fr
 Practice Exam Sample Input:
 Test 35
cymeo
 Test practice 3 Nov
cameo
camel
camel

Sample Output:
100

Explanation: The only valid 3-tuple is (cymeo, cameo, camel). This tuple starts with cymeo. So we have 1 tuple
starting with attempt 1, and 0 tuple starting with any of the other attempts.

Sample Input 2:
45
camyo
cameo
camio
camel
camel

Sample Output 2:
4040
Explanation: Among all possible valid 3-tuple sequences, camyo, cameo, camio and camel can come at first
place in 4, 0, 4, 0 sequences respectfully.

YOUR CODE
44 ········}¬
45 ········for·(int·i=0;·i<n;·i++){¬
46 ············if(count[i]==0)·printf("%d·",·count0*2);¬
47 ············else·printf("0·");¬
48 ········}¬
49 ····}¬
50 ····if(n==5){¬
51 ········int·count0=0;¬
52 ········for·(int·i=0;·i<n;·i++){¬
53 ············if·(count[i]==0)·count0++;¬
54 ········}¬
55 ········for·(int·i=0;·i<n;·i++){¬
56 ············if(count[i]==0)·printf("%d·",·count0*2);¬
57 ············else·printf("0·");¬
58 ········}¬
59 ····}¬
60 ····¬
61 ····return·0;¬
62 }¶

GRADING STATUS
This assignment has been awarded 15 marks out of 60.

"Your submission has been autograded based on 10 test cases with max marks as
follows: 0 + 0 + 5 + 5 + 5 + 5 + 10 + 10 + 10 + 10 = TOTAL 60 Your marks for test
case 1: 0 / 0 There is no partial marking for this test case. Your marks for test case 2:
0 / 0 There is no partial marking for this test case. Your marks for test case 3: 0 / 5
There is no partial marking for this test case. Your marks for test case 4: 5 / 5 There is
no partial marking for this test case. Your marks for test case 5: 0 / 5 There is no
partial marking for this test case. Your marks for test case 6: 0 / 5 There is no partial
marking for this test case. Your marks for test case 7: 0 / 10 There is no partial
marking for this test case. Your marks for test case 8: 0 / 10 There is no partial
marking for this test case. Your marks for test case 9: 0 / 10 There is no partial
marking for this test case. Your marks for test case 10: 10 / 10 There is no partial
marking for this test case. ------------ Total autograder marks rounded up to: 15 / 60"

Tell us why you want this to be regraded...

Request Regrading

Assignment has be re-graded.

You might also like