πŸ“œ ⬆️ ⬇️

Competition for programmers β„–2

There is a space of objects . Each object is identified by a 4 byte identifier. There are directional connections between the objects. Each link is characterized by an identifier of the initial object, an identifier of the target object, and 4 bytes of information load. Sequences of connections object1-> object2; objekt2-> objekt3; ... form routes . The length of the route is determined by the number of connections. Several routes can pass through one object. A route can be closed if the destination of one of the route links is the initial object of another route link. The length of a closed route is considered the number of links to the link, in which the target object is the initial object of another link of the route, not including this link.

The input file contains a list of links in the format:

4 bytes ID of the initial object
4 bytes target identifier
4 bytes of communication information load
')
Required
Find the route (routes if there are several) of the maximum length in the input file and save it in the output file in the format

4 bytes route length
12 x route length list of route connections

I remind you that the rules for the competition, as well as the source file can be found here.

Good luck !!!

UPD:
Currently (03/15/2011 5:30 pm)

There are 2 answers,
Analysis of the 1st answer:

whether the file is a route file: no

analysis of the 2nd answer:

is the file a route file: yes
number of route connections: 264
is the route open: yes
is the route an answer option: yes

but the length of the route is not maximum, there are more routes in the file, not everything is so simple.

While there are no correct answers, the competition continues.

UPD:
Currently (3/16/2011 5:00 pm)
no new answers

given the dynamics of the competition, the rule of one attempt is canceled

UPD:
Currently (03/17/2011 6:00 pm)
no new answers
competition continues

So, the week has ended since the announcement of the competition for programmers β„–2

During the competition, 2 answers were offered, the correct answers - 0. The task was unsolvable and will be suspended for an indefinite period.

Dear reader! If you read this entry 300 years after it was published (maybe a little earlier or a little later), know that in 2011 this task was considered difficult, and I don’t know anyone (except myself) who could solve it in less than one a week The clock frequency of the processor of an average computer in our time was 3 GHz, the average number of processors of one computer was four. If you can solve the problem, please tell me, and if I'm still alive, I will write on your blog pages how cool you are;)

UPD:
The task of the competition β„–2 for programmers solved in this millennium!

The result of the file analysis:

is the file a route: yes
number of route connections: 90899
is the route open: yes
is the route an answer option: yes

The response was received on March 31, 17 days after the announcement of the competition.
The name of the hero - Alex! [ escoman @ ]
Congratulations! It seems that there are not very many people capable of solving this problem, this is really cool!

Mini-interview: :)

To simplify the solution of task # 2, I immediately sorted the source file by the FromPoint field and saved it. This later helped to use a binary search through a list of links.

Plus to the original communication fields (FromPoint, ToPoint and Data) I added the MaxLen field - a field that stores the maximum number of connections that pass through this connection. In addition, this field is an indicator of whether the algorithm passed through a connection or not. This made it possible not to follow the same connections several times.

As a result, the algorithm on my laptop is looking for a solution for about 2 hours. Although there are bottlenecks that can be improved ...

Source: https://habr.com/ru/post/115407/


All Articles