I glad to invite to take part in USACO contest is from Dec 13 to 16, remember this contest is IOI style. good luck
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
I glad to invite to take part in USACO contest is from Dec 13 to 16, remember this contest is IOI style. good luck
Name |
---|
in problem 3 in Bronze division I can't underestand , we must only count number of pair of points that they will be trapped in cycle or any cycles ?
For example suppose we have 4 points that they form a rectangle and points on one diagonal have paired each other,then we must count this cycles ?
Don't discuss the problems here before the contest ends!
It seems something is wrong with the USACO server right now.The website takes a long time to load,and my submission is shown as "Being Judged" instead of "sample case solved correctly".Anyone experiencing the same issue?
Well the site appears to be completely down now, so I'm wondering what's gonna happen.
I submitted now, and it seems to be working. Well, no server is truly stable.
The contest has ended.
How to solve 2nd problem of Gold division?
Dynamic programming with segment tree.
Each node of segment tree should contains dynamic array d[2][2]. d[hasLeft][hasRight] means what is the answer to the problem on the corresponding segment if the left machine from the segment used (hasLeft), and the right machine from the segment used (hasRight).
Thanks, got it. What about the 3rd problem?
The third problem is about permutations. It's hard to explain easy, but I will make a try.
Consider your transformation as composition of two. The first one is multiplying the prefix of your permutation by the given permutation. The second one multiplying the prefix of your permutation my cyclic shift, so as to move the first number to the end of the prefix.
The next step is to understand how the process works. It's not hard to get that it is possible to get the current k-th number from the card deck if you know the cycle of permutation p (that is composition of two described above) that contained the element |p|.
I think with these two hints and with some thoughts you can get the whole solution.
Also notice that only the first M and last M elements of the resulting permutation (of all N elements) are non-trivial: k > M + 1-th element will be k - 1-th incremented by 1.
I imagine the superposition of permutations (P and right-shift) as some boring cycles and one non-cycle — a machine that's moving along a tape (some of the numbers 1..M are inside it already, and M+1..N are yet to go inside), and when moving along the tape, it always just moves the tape by 1. You can see that it takes the next number of the tape and ejects the first one still inside, so it doesn't change the order of elements on the tape. It'd be cool to construct such a machine :D
I was lazy to implement segment trees, so I just did some sqrt-stuff.
Notice that the upper bound on N is 40000 = 2002. So just split the array into sequences of 200 consecutive elements, do an initial DP (as Gerald describes) on each of them, and for every query, another DP on the one that changes. This allows you to count the DP answers (as in the bruteforce DP) for every 200th element, and compute the last N%200 states by bruteforce.
It's easy to see that the same idea works on merging the DP answers for any 2 intervals, so you can take it as a motivation for the solution using segment trees...
Nice, thanks. It is 50000*200 on the worst case as I understood. Is it ok? My solution for the first problem is O(K*logN+Q*K), which is nearly the same, and I thought it may timeout on large cases.
It doesn't have to pass all the tests, and I don't care if it even contains a bug and completely fails. USACO is not worth it for me to exert any effort in getting my solutions to pass certainly — I don't gain anything from it. I'm just trying out various approaches, and "how fast is an sqrt solution here?" is one of them.
Another one is making this training for no feedback. This is also training for the USA team for IOI, and I don't understand how anyone would deliberately try to decrease their chances of success at the competition by using completely different environment. IOI is a lot about strategy, and gaining some "guaranteed" points is a crucial part of it, especially if you're not aiming for all or nothing. Being able to code well without feedback may be good, but if you do have feedback, then being able to code equally well but with the additional benefit of feedback is even better...
3rd Problem, Silver Divison, help, please.
In third problem we just had to build such a graph that would show us the sequence in which the cards will leave the deck. So this is easy to predict if we mention that after the shuffle(we have a graph on input that shows us the shuffle for M cards) when we take each card off we just send each card one position left. Let us shuffle the cards the first time and then build the graphs. So, we have 2 graphs that we have to unite into one. One graph that is given on the input(let's call it "S") and the other one that sends each card one position left let's call it "Co". So our final graph("Fin") would look like Fin[i] = S[Co[i]]. The first card that will leave the deck is the card that stands on the first pos after the shuffle. The second one is such a "j" for which "Fin[j] = 1". The third one is a j for which "Fin[Fin[j]] = 1" i.e. the ith card to go out will be such a j for which distance to the first node is i-1. We have to find first M cards according to the Fin graph and the N-M cards are the ones that are left in an order from smallest to biggest because we do not do the shuffle and card off after there are <M cards.
So, we basically had to implement the shuffling and taking a card off processes and find the sequence in which the cards will go out.
This is my submission for this problem.
I hope it pass all tests and help you too.
Scores published, perfect one for me on bronze. Silver division \o/
Here