A question about SRM717 div1 easy

Revision en1, by PengsenMao, 2017-07-01 05:07:24

Hi guys, i participated srm717 last night, and submitted q1, here is my idea (but failed in system test, i have no idea)

First we know there is one and only one solution, which makes the difficulty of this problem located on constructing the graph.

So i came up with a greedy idea:

(1) we sort S[] from small to big, then we bruteforce i from 1 -> n

(2) we try to choose some nodes to be connected with node i, the nodes should satisfy that

they haven't been connected with i yet

their outdegree should be as small as possible

then i passed all the examples but got failed in system test.. i am a bit curious

btw the contest is not active therefore i can't see the test data

Thanks guys :)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English PengsenMao 2017-07-01 05:08:09 1 Tiny change: 'lem located on constr' -> 'lem locate on constr'
en1 English PengsenMao 2017-07-01 05:07:24 749 Initial revision (published)