It was enough interesting problems, I suggest discuss some of them. Who has proofed solutions of E and H?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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 colorC
and remember neighbour with color(C-1+K)%K
as previous for 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 colorK-1
(0-based), so there is adjusted vertexu
witch has colorK-1
. Here is some simple path from vertexu
which is constructed by walking to previous vertices, and it's length is not less thanK-1
, so by adding edgeu->v
we have sought-for path with lengthK
.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.2377n), but we don't have an access and maybe this is an overkill.
This paper looks simpler, but it says this is O(1.62n) 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://mirror.codeforces.com/blog/entry/47641?#comment-319796
is not very hard to invent without any papers.
It works in 1.46n or 1.38n (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 read special papers during the contest, and got OK.
Please, "like" this comment,
if you did not used any 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!!!!