You are not logged in. Please login at www.codechef.com to post your questions!

×

How to solve Game of Numbers from MNM 2018?

Can someone explain their logic for the problem?

https://www.codechef.com/MOPC2018/problems/GNM

I wonder how it had 10 times more submissions than the much easier second problem.

asked 28 Feb, 15:32

abdullah768's gravatar image

6★abdullah768
2.4k420
accept rate: 17%


It is a copy of spoj problem "Play on Words". U can have a look at solution here it is pretty much clearly written except there letters are used and here numbers are used Link:https://www.quora.com/How-do-I-solve-the-SPOJ-Play-on-Words-problem

link

answered 28 Feb, 16:41

beginner_1111's gravatar image

4★beginner_1111
240110
accept rate: 13%

1

Thanks for the link! Many of the submissions did not even consider the disconnected graph thing and still managed to get AC. Weak test cases perhaps.

(28 Feb, 17:28) abdullah7686★

Even at the second problem they doesn't give the constraints. I assume the constraints 2<=n but in some test cases they are n<2 which doesn't have any meaning with respect to questions. Even i asked this question and i amazed with such there reply. They said "it is an integer that it. It is up to you". Its ok its an integer but you should properly define it because integer can be so large even 10^100 is an integer. It wasted lots of my time. Now i will never participate in these kinds of contest. I know its very difficult to design problems but still they need to take care of these things.

link

answered 28 Feb, 16:55

droy0528's gravatar image

4★droy0528
956
accept rate: 16%

link to my solution... https://www.codechef.com/viewsolution/17564528

logic : i have just created a hash table which contain frequency of first and last number of any integer ( 786 hsh[7]++,hsh[6]++), and i have considered a number which are less than 10 as a 2 digit number ( 7 , hsh[7]++,hsh[7]++ ) assuming this digit as starting and ending for the sequence... and finally all even frequency digit will involve in sequence and a odd frequency number may be starting and terminating digit of first and last number so if odd frequency number is more than 2 then not possible else possible. plz reply if u have any doubt.

link

answered 28 Feb, 19:54

nk159926's gravatar image

1★nk159926
11
accept rate: 0%

Your code fails in this test case:

1

5

12

21

13

31

77

Expected: No Your Output: Yes

(28 Feb, 20:21) vivek_19982996★
1

@vivek_1998299 oh yes, you are totally correct, this will not result good in case of components ( disconnected ) and still this code got accepted , @abdullah768 very weak test case indeed .

edit : @vivek_1998299 plz suggest any solution for the same without converting it to a graph ?

(28 Feb, 21:21) nk1599261★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×71
×37

question asked: 28 Feb, 15:32

question was seen: 231 times

last updated: 28 Feb, 23:28