It was enough interesting problems, I suggest discuss some of them. Who has proofed solutions of E and H?

Before contest

Codeforces Round #472 (rated, Div. 1, based on VK Cup 2018 Round 2)

09:39:47

Register now »

Codeforces Round #472 (rated, Div. 1, based on VK Cup 2018 Round 2)

09:39:47

Register now »

*has extra registration

Before contest

Codeforces Round #472 (rated, Div. 2, based on VK Cup 2018 Round 2)

09:39:47

Register now »

Codeforces Round #472 (rated, Div. 2, based on VK Cup 2018 Round 2)

09:39:47

Register now »

*has extra registration

# | User | Rating |
---|---|---|

1 | Petr | 3325 |

2 | Um_nik | 3284 |

3 | Syloviaely | 3258 |

4 | tourist | 3206 |

5 | anta | 3106 |

6 | fateice | 3099 |

7 | mnbvmar | 3096 |

8 | OO0OOO00O0OOO0O0…O | 3083 |

9 | Radewoosh | 3076 |

10 | HYPERHYPERHYPERC…R | 3071 |

# | User | Contrib. |
---|---|---|

1 | tourist | 183 |

2 | rng_58 | 169 |

3 | csacademy | 162 |

4 | Petr | 158 |

5 | lewin | 152 |

6 | Swistakk | 151 |

7 | matthew99 | 146 |

8 | Errichto | 142 |

9 | BledDest | 141 |

9 | Zlobober | 141 |

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/24/2018 08:55:13 (d2).

Desktop version, switch to mobile version.

User lists

Name |
---|

Where can we find the problems?

If you have the opencup login then here: link. Until I don't know, could I post statements here.

H: Let's find a dfs search forest (from some vertices in each connected component). If it contains a path of length

k+ 1, print it. Otherwise, color each vertex with it's depth in the corresponding dfs tree.Any ideas for problem I?

I do not know which solution did you mean, but my solution is proved by design.

Let's start coloring vertices using dfs. Each time we'll try to find such color

`C`

that is not used by neighbours, but color`(C-1+K)%K`

is used. When paint vertex in this color`C`

and remember neighbour with color`(C-1+K)%K`

aspreviousfor current vertex.If we do not fail on such painting process, we have a graph's coloring. Otherwise, we failed on painting of some vertex

`v`

. That does mean, it neighbours uses all the colors, including color`K-1`

(0-based), so there is adjusted vertex`u`

witch has color`K-1`

. Here is some simple path from vertex`u`

which is constructed by walking topreviousvertices, and it's length is not less than`K-1`

, so by adding edge`u->v`

we have sought-for path with length`K`

.How to solve C?

Problem C:Consider multigraph on n vertices (not 2n!).

Disjunction ([not]x[i] | [not]x[j]) is edge between vertices i and j.

The solution is recursion (backtracking with optimizations).

If value of any variable may be deduced, deduce it.

If there are to connected components, calculate it separately, multiply results.

Fix unknown variable of maximum degree and do 2 recursive calls.

Your may add memoization to speed up the solution.

Your may handle the case of "maximum degree is two" in polynomial time.

As I know, the first 3 ideas were enough to get OK.

P.S.

T(n) ≤T(n- 1) +T(n- 1 -maxDegree)UPD:(4) implies (2) for components of size 1 (degree equal to 0)I just used memorization only.

Even no (1) and no (2)?

I saw that (1) happens automatically and thought solution is good enough as it is. I did not realize that hueristics can actually reduce the exponent.

We used just 1 & 4.

E: Main idea: number of ways to divide subset only depends on count of vertices. We can use DP to calculate it for every size.

Let's find first pair in subset. Sort all possible pairs and iterate over them. We need to know number of ways with this fixed pair in order to choose, take this or not. Number of ways depends only on size of left and right subset. Find this pair and recursively solve at first for left and then for right subsets.

What about I? We had 2^32*const solution, it was too slow, like 45 seconds instead of 5

I've seen several "read a paper" problems in Open Cup but I've never solved it. How do you solve it?

Search, read, understand, and implement a 10-page paper during a contest looks overwhelming to me. Is it important to find an easy-to-read article? Do you know the algorithm beforehand? Are you actually very good at reading papers?

Could you please give a link to the paper?

According to wikipedia the fastest algorithm is

O(1.2377^{n}), but we don't have an access and maybe this is an overkill.This paper looks simpler, but it says this is

O(1.62^{n}) but I'm not sure if this is fast enough.This paper is fine. The algorithm presented there is even harder than needed, what I've successfully submitted looks like:

But I think that using such classical problems on a competition is a completely bad idea. All I had to do was to know that this problem is called #SAT (or sharp-SAT). Also, this particular problem is very hard to prepare, I'm not sure that it is possible to come up with reasonable tests for it.

By the way, it is one of the main counting problems that arise in CS, the #3SAT is actually a #P-complete problem, meaning that many counting problems may be reduced to it, like 0-1 matrix permanent, counting number of topological sorts of the DAG, counting number of correct k-colorings, and several others.

This one

http://codeforces.com/blog/entry/47641?#comment-319796

is not very hard to invent without any papers.

It works in 1.46

^{n}or 1.38^{n}(if you handle the last case).In practice it works faster.

To solve you have to know only one base idea "consider graph, take vertex of maximal degree".

P.S It's interesting to know, how many people used papers from google to get OK.

Please, "like" this comment,

if you

readspecial papers during the contest, and got OK.Please, "like" this comment,

if you

did not usedany special papers during the contest, and got OK.173 people got OK?

Anyway, if we believe the ratio, it seems we should ignore the paper and solve it as usual.

Possible reasons: If you rating is high, your upvote gives more than +1. Also most teams consist of three members.

Lol, your upvote gives +2 at maximum, there are 3 members at a team and 19 teams that solved this problem, giving us 114 votes at maximum.

I believe there were lots of people who didn't even participate in opencup, but who like the idea of using or not using any papers in general, and who felt that it is fine to give their upvote for one of the options, even though they were not asked for it.

Despite the fact I've never solved, let alone attempted such a problem, I suppose it's more about having an eye for a particular algorithm, which usually means you have already implemented the said algorithm in the past at least once or twice, and all you need during the contest is a quick(?) rehearsal.

How to solve G?

Just try to randomly generate some sets with sizes 10..1e7 and look at the min/max/avg value of distinct_values/total_asked_values (hint: it's better to ask 10_000 values).

Then you'll able to find the answers and insert it to the main program.

My solution used Birthday Paradox. That is, the number of questions until two cards repeat is somehow close to sqrt(n), where n is the size of the set.

Let's do the following procedure: while I still have questions, ask questions until two cards are identical. Then, store in a vector number of question asked and repeat.

All numbers from my vector should be close to a value of sqrt(n), where n is in the set {10, 100, ...., 10^7}. The only remaining part is to find n such as numbers from my vector match best sqrt(n).

Let's iterae over powers of 10 and call X = sqrt(current number). We simply need to find an heuristic to see how close are number from the vector to X. We used sum {(vector[i] — X) ^ 2}

Then, pick X such as the sum is minimized and output corresponding power of 10.

I used Bayes formula and returned sets size with maximum probability (using uniform distribution over allowed values as prior).

Had solved stringy problem 'J' (about timer) with Perl, 127 lines (ideone).

Anyone know how to solve problem I?

The main ideas are described in Petr's blog:

http://petr-mitrichev.blogspot.com/2016/11/an-unshuffle-week.html

Thanks so much!!!!