Jiraiya, one of the Konohagakure’s Sanin, is out for a world visit for M months with his supporter Naruto Uzumaki, looking for information that would support his companions. 
On his excursion, he finds a reality S (a string) each month. Additionally, he makes a rundown of a few women who can help him in his significant exploration for that month. Yet, he can meet precisely one of them toward the finish of month. To choose the one, he initially ascertains the score for every woman in his rundown. He characterizes score for every woman dependent on her name as: 
“Complete number of aftereffects of certainty S, which are re-arranged words of the name, modulo 998244353” 
Jiraiya meets the woman with the most elevated score. On the off chance that there are more than one women with the most elevated score, he meets the one whose name starts things out in his rundown. On the off chance that all names have score 0, at that point he can’t meet anybody. 
Naruto realizes that this assignment will make his lord, Jiraiya, invest an excess of energy in figurings. Thus, he needs to assist his with acing by composing a program which can do the above assignment rapidly, so his lord can invest more energy in his preparation. He needs the program to ascertain the score for every woman in Jiraiya’s rundown, lastly print the outcome, for example the name of the woman whom Jiraiya will meet. On the off chance that Jiraiya can’t meet anybody, the outcome ought to be “No Research This Month” (without cites). Since Naruto isn’t acceptable at coding, he needs your group’s assistance to code this out. 
An aftereffect is a succession that can be gotten from another arrangement by erasing a few or no components without changing the request for the rest of the components. Two aftereffects are viewed as various if the places of erased components (in the first string) are distinctive for both the aftereffects (Even if these two aftereffects seem to be comparable). For Example: If abb is the first string, at that point the aftereffects abdominal muscle and abdominal muscle will be viewed as various on the off chance that they speak to the positions {1,2} and {1,3} in the first string separately. 
A re-arranged word of a string is any reworking of that string. For instance, for the sting abb, these strings are re-arranged words: abb, bab, bba. 
First line contains M, the quantity of months. Every month is depicted as follows: 
First line contains a string S, speaking to the reality found in the month. 
Second line contains a whole number N indicating the complete number of names in Jiraiya’s rundown for the month. N more lines follow. 
ith line contains a string namei, for example the ith name in Jiraiya’s rundown. (for 1≤i≤N) 
For every month, print N+1 lines: 
ith line (for 1≤i≤N) ought to contain a solitary whole number indicating the score of ith woman in Jiraiya’s rundown. 
(N+1)th line ought to contain the outcome as depicted in the difficult explanation. 
S and namei contain lowercase English letter sets as it were. 
Test Input 
Test Output 
No Research This Month 
No Research This Month 
first Month: 
For kylie, these 2 aftereffects are re-arranged words: 
ykeil (here e is from position 10). 
ykeil (here e is from position 12). 
Subsequently the score is 2mod998244353=2 
Correspondingly, for disha, 4 aftereffects are re-arranged words, so the score is 4mod998244353=4. 
Furthermore, for tsunade, 8 aftereffects are re-arranged words, so the score is 8mod998244353=8. 
Out everything being equal, tsunade has a most extreme score, so Jiraya gets the opportunity to meet tsunade this month. 
second Month: 
The two women have a score of 0. So Jiraya doesn’t get the chance to meet anybody. 
third Month: 
No re-arranged word is workable for kushina, so her score is 0

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS


Related :

Related :

Leave a Comment

one + 2 =