Codeforces Beta Round 22 (Div. 2 Only)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
22 Codeforces Beta Round 22 (Div. 2 Only) FINISHED False 7200 462380390 June 29, 2010, 3 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1755 ) E Scheme PROGRAMMING dfs and similar graphs trees 2400

B"To learn as soon as possible the latest news about their favourite fundamentally new operating system, BolgenOS community from Nizhni Tagil decided to develop a scheme. According to this scheme a community member, who is the first to learn the news, calls some other member, the latter, in his turn, calls some third member, and so on; i.e. a person with index i got a person with index fi, to whom he has to call, if he learns the news. With time BolgenOS community members understood that their scheme doesn't work sometimes -- there were cases when some members didn't learn the news at all. Now they want to supplement the scheme: they add into the scheme some instructions of type (xi, xe2 x80 x89yi), which mean that person xi has to call person yi as well. What is the minimum amount of instructions that they need to add so, that at the end everyone learns the news, no matter who is the first to learn it? The first input line contains number n (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105) -- amount of BolgenOS community members. The second line contains n space-separated integer numbers fi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89fi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, xe2 x80 x89i xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89fi) -- index of a person, to whom calls a person with index i. In the first line output one number -- the minimum amount of instructions to add. Then output one of the possible variants to add these instructions into the scheme, one instruction in each line. If the solution is not unique, output any."...

Tutorials

Codeforces Beta Round #22 Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
95171 Rotsor E June 29, 2010, 4:51 p.m. OK Mono C# TESTS 40 1530 20172800 2400
95075 Kasparyan_Mikhail E June 29, 2010, 4:41 p.m. OK MS C++ TESTS 40 230 4710400 2400

remove filters

Back to search problems