Hi!
I’d like to invite you to Codeforces Round #431 which takes place at 16:35 MSK on 1 September. Please note that the timing is again unusual.
One of the problems is created by adedalic and KAN, while the others are authored by me. This is my second round here, and it couldn’t have been realized without efforts of: AlexFetisov, ifsmirnov, Tommyr7, winger and wu_qing who tested the problems; KAN who appears to be a meticulous guide throughout the preparation process; and MikeMirzayanov with the supercalifragilisticexpialidocious Codeforces and Polygon platforms — my deep gratitude to you!
Both divisions are welcomed as rated contestants and will have five problems to solve in two hours. The scoring will be announced later.
Once upon a time, in a virtual galaxy far, far away, there was a lovely young singer by the name of Hatsune Miku. One lovely day, Miku got a job as a vocalist in Vocaloid, and that was very exciting. People said, “Oh, Miku, you sing so accurately! And so emotive, too!” Soon everyone was talking about Miku, and there were songs and paintings and even live concerts for, and with, Miku. Miku liked that.
And you, are to start a journey following the emotions in Miku’s voice. Oh, by the way, a late Happy Birthday to her — August 31 is (was) her tenth anniversary.
For the world you live in, thank you.
See you then, and wish everyone few bugs and fair ratings.
UPD 1 Scoring will be:
- 500-1000-1500-2000-2500 for Division 2;
- 500-1000-1750-1750-2500 for Division 1.
UPD 2 System test is done. Congratulations to the winners!
Division 1
Division 2
- lmmortalCO (solved all problems!)
- ltg2030
- FoolMike
- HatsuneMiku
- MisakaKuma
Also, thanks to all who participated! Nicely done!
Check out the editorial with hints!
UPD 3 Complete tutorials and behind-the-scene fragments are out. Problem packages may be published soon, stay tuned!
Miku? I'm in!!
Bad luck. Solution for A and C was correct. If these two got rated then.... Alas! they got skipped.
want some downvotes, just ask is it rated? Just see my downvotes.
I upvoted you bro....now see my downvotes!
"supercalifragilisticexpialidocious" what ? :|
It means "extremely wonderful". :)
It's supercalifragilisticexpialidocious
Even though the sound of it is something quite atrocious
If you say it loud enough, you'll always sound precocious
Supercalifragilisticexpialidocious :)
https://www.youtube.com/watch?v=tRFHXMQP-QU
There's a Linkin Park song too!
oh, supercalifragilisticexpialidocious, I finally know how to pronounce this word
Two Faced Lovers <3. Tell your World <3. Miku Hatsune <3. Rated Div 1 contest <3.
I am new to codeforces... So can i join the contest? Because its asking for ratings...
Yes, you should register in Div2 contest. However, you should not ask if the contest is rated unless you want to get -2137 contribution.
I just realised Hatsune Miku literally means first sound from the future.
0w0
I as well would like to know in the fullist if this contest on the code force will count towards my codeforce rating on the codeforces.com webite on the internet on the wires that are inside the tubes that the internet is made of.
[deleted]
Happy Eid for you all :D
Probably the best english I've read in a long time on CF, hope the problems will be as easy to read as the announcement :D
6:35 AM? Seriously? Gonna participate it for Miku Hope this round will not be a typical China round :P
bilibili (゜-゜)つロ che.... Oh wait wrong platform.
"Soon everyone was talking about Miku, and there were songs and paintings and even lives for Miku.
I'm sorry, what?
Have I missed the weekly sacrifice? I thought it was called off.
My birthday.Oh yeah! I'll be glad to with you in codeforces.>w<
Hope for good quality problems :)
Codeforces with Miku is so good!I will be definitely in!!!(Although I 'm so weak...)
Am I the only one who doesn't know about Hastune Miku?
Are you serious? ._.
Well he/she may be a famous person in your country but I really had never heard this name before.
You can read more in Wikipedia, but feel free just to enjoy the problems without such background knowledge.
before your comment I was thinking I'm the only one.
Please don't use these hard names in problems please. It makes difficult to understand also is it rated?
Eager to participate after a long time -> See Miku in the blog -> Decided to go to sleep instead.
Awesome feature of showing rating change in leader-board during the contest.
i hope there won't be long stories about Miku in the statements..
There won't, enjoy :)
I know a sentence to get lots of downvotes,but I will not say
You just did.
It's out of my expectation
Happy birthday, Hatsune Miku! Thank you for bringing so many wonderful songs to us!
Codeforces means nothing, Miku means everything.
Give me 50$ or I will tell Cristina what you said
Give me 50$ or I will tell I_Love_Tina what you said
bilibili (゜-゜)つロ chess!!!Happy birthday Hatsune Miku!!!
Last line of the blog : "wish everyone few bugs and fair ratings." :(
Good news for hacker :(
"few" means "not a lot", "a few" means "some", so in fact wishing few bugs is wishing well, while wishing a few bugs is wishing bad.
I am getting error : 502 bad gateway..
If it is problem of the site please check it so that it wont effect the competition.
Happy Coding!
Hope this round be rated!
Hope this contest goes well!
Another anime-contest?) This year have many anime-contests)
Maybe next year will have >= contests with anime theme? Does someone else want it? :)
Good luck everyone! 502 will not stop us!
Please, don't start the contest till you fix the problem 502 Bad Gateway
I am not sure, but looks like it was fixed(I tried refreshing 20 times).
Now the issue will return because everyone who will read your comment will try to refresh 20 times :D
This is not how you check it :)
They need to look at nginx access.log.
How can we see those logs? I think a only admins can see them.
Eid Mubarak to everyone :-)
Hope, 502 Bad Gateway don't appear during contests!
Scoring?
Miku~
And the count down starts...10, 9, 8, 7,...0
let it begins
Auto comment: topic has been updated by cyand1317 (previous revision, new revision, compare).
Not able to hack ..... page is stuck at reloading again and again...
This is experienced by some contestants. We're working on this, please go on to other problems first. Sorry for the issue.
same issue here, and i am 90% sure i can't solve any of the other problems. also i am 100% sure the code i am trying to hack is incorrect. :-(
EDIT: after refreshing about 20 times, i was able to successfully hack the above mentioned code. :-)
There are no memes in the comment section?
spits coffee
so after forty minutes i didnt solve problem a or problem b
i give up :( i should stop doing cp
This contest looks to be difficult
Welp,not only you, this contest difficulty gap seemed kinda much for Div2 contest..
Moderator I hacked the solution of user — "redcpp". verdict is saying unsuccessful but in his logs its written that his solution is hacked by me. Update marks.
This happened to me in contest 429. Nothing came of it.
Titles are all Hatsune Miku songs~
Currently 22 minutes left until the end of the contest, and I have been trying to hack one of roommate's codes for the last 5 minutes (with this error).
EDIT: I was eventually able to (successfully) hack this code, however I couldn't hack the (incorrect) code of another participant due to this error. And after repeatedly refreshing the page I saw that the participant had resubmitted a correct code (without being hacked by anybody else).
Div. 2 + Div. 1 round? More like Div. 1 + Div. 0 round. RIP Rating.
I also think so, I couldn't even understand statements of c, d and skipped to E(Hope it passes though, or I will get -200 rating change).
Ima get -100 at least for sure. E looks like a problem I can solve, but I just didn't read it. Now I have only A :(
Pretest 3 on C is k = 0.
Your code prints nothing but it should print a single character :(
Oh yeah. I guess this isn't my day :( If I found that bug I would've solved it in the first 30 minutes.
rip rating too , hate geometry so much :C
How to solve div2 d?
sort
sort what?
for horizontal , consider the point to be at ( - ti, yi)
for vertical , consider the point to be at (xi, - ti)
Now consider each diagonal (Same x + y) at a time
Only points among the same diagonal will collide and each point's direction will alternate after each collision.
Thank you for kind explanation. Thanks so much.
Such a great observation!!! Thank you so much
thx
First notice that instead of looking at time the person starts, you can simply set their x/y coordinate to -t (depending on what way the person is facing). Then notice that instead of imitating a collision, you can just swap the indexes of the people colliding, since they just swap trajectories. Then also notice, that you can place people in buckets based on the sum of their x and y coordinate (people with the same x+y go into the same bucket). In those buckets, every vertical person will collide with every horizontal person, and vice versa. Now, next thing to notice is that every horizontal person will hit vertical people in the order of their x coordinate. Therefore, the last index that carries that trajectory will be the index of the furthest right vertical person. Yes, there's a lot of noticing in this task. At this point you could probably implement it, but there are a few more things to notice if you want to have a nice, clean implementation, but I don't know how to explain what I did, so I'll leave it as practice (if someone really wants to I can try to explain)
Also, cyand1317, I absolutely loved this task, thanks!
Edit: while I typed this someone already answered. I hope this will still be helpful to someone!
Thanks for the explanation, for me it's much easier to grasp than official editorial. Only last step (how to properly sort dancers and final points, then match them) is to be applied to your solution to get ACC. It's described in editorial, but if you don't mind I will explain it here to finish your solution.
If you sort all dancers in one bucket wrt their initial x positions (for horizontal dancers it will be -t_i, and x_i for vertical ones), and sort all final points for this bucket in order (0, h)->(w, h)->(w, 0), you may realize the next thing:
The same logic could be applied to the next dancers... Just imagine the picture and you will get the idea.
I hope this would be helpful for someone who doesn't want to spend 5 hours on this problem:)
My submission.
Thanks for completing my comment, here's my submission too, if someone's interested: 29986966
Supercalifragilisticexpialidocious problem C. (E div 2). Thanks >__<
The first time getting rank 25 in div.2
:)Happy
Well, wasted too much time on D.
I think this guy is cheating
? Why?
Did anyone pass problem DIV1 C with Mo algorithm working in O(n^(5/3))?
Btw by n^(5/3) I mean this optimization : http://mirror.codeforces.com/blog/entry/44711?#comment-292040
i got tle with something like n*sqrt*log lol. used sqrt decomp on queries
But n^(5/3) is less than n*sqrt*log...
My N*sqrt*log passed in 5912ms ._. (which most likely means that it's gonna fail systest anyway)
In theory, n^(5/3) is more :P
;_;
Nice idea, I see what you did there.
Yes 29985009
How to solve div1B? I feel so stupid
Suppose a dancer travelling vertically having position Xi and wait time Wi, and a dancer travelling horizontally having position Yj and wait time Wj meet at time T. Hence,
(Wi + T) = Yj and (Wj + T) = Xi
This will be used to check collision condition and time.
(Xi - Wi) = (Yj - Wj) and T = (Xi + Wj)
Now, sort dancers travelling vertically by Xi and dancers travelling horizontally by Wj. Store dancer indices for each distinct difference (Xi - Wi) and (Yj - Wj) for each type of travellers.
For one particular difference, consider 2 vectors, 1 of horizontal travellers and 1 of vertical travellers, each element of 1st vector will intersect with each element of 2nd vector. Final positions of dancers from these 2 vector will just interchange among themselves independent of other dancers.
Collision happens in sequential order. That is i from vector 1 will intersect with j1 and j2 from vector 2 in order of j1 and j2, same holds other way.
This sequential order can be used to decide final position of each traveller of these 2 vectors combined in O(n). You just need to traverse these 2 vectors in particular order. Sorting the travellers takes O(n * log(n)) time.
Code
Don't, it was pretty hard (IMO).
You can group the people, so in one group all possible collisions happen, and no collision happens between groups. You have to group by pi - ti. The previous statements can be proved, for same and different pi - tis. After that, you can solve the problem for one person in O(1). I'll leave that thinking to you :)
How to solve div1C?
Let's change find sum of max-min into sum of nxti-i where nxti is next element with value equal ai and nxti <= r. Now it's a very standart problem, I did it with bit and sqrt decomposition
I came up with this, but you need to subtract the values on the first apparition of an element, how to do that? I'm shit at data structures :P
Actually, only 2 or 3 values will get changed, so you can update it easily.
Nvm I missunderstood your comment, now i get it, thx :D
I am surprised that I found Div-2 C pretty hard, but still more than 1000 participants solved it. Looking forward to the solution.
a => 0 aa => 1 aaa => 3 aaaa => 6 ... a(n) => (n)*(n+1)/2
16 = 10 + 6 => aaaaa bbbb 12 = 10 + 1 + 1 => aaaaa bb cc
Although I cannot assure this is the right solution, I pass pretest in this way.
Here is the proof that this approach is indeed correct. Firstly, breaking the given sum into characters, it is evident that we can compute the cost of merging characters of one type, and sum across all characters at the end.
Now, we claim that in order to merge n of one character, the cost required is always regardless of how we merge. We prove this by strong induction on n, the base case being obvious.
Now if the last merge is merging a string of length x with a string with length y, by induction hypothesis we get that the cost so far is Now the last merge itself costs xy so the total cost becomes as claimed.
Nice proof! What is the name of this identity?
I don't think it really has a name, but I guess it's a special case of Vandermonde's Identity where r = 2.
First, we'll find the minimum accumulative cost of a string. In fact, we will prove something more: the accumulative cost of a string doesn't depend on the order they are combined.
Imagine that between every pair of identical letters, we have a tune. Thus for example, in the example string
abababab
, each pair ofa
's have a tune between them, and so as each pair ofb
's. That's a total of 12 tunes. We claim that the accumulative cost is simply the sum of all tunes.To do so, we will remove a tune at the moment that the pair of letters are merged into the same string. For example, when we merge
aba
andac
, the two pairs ofa
's (pick eithera
inaba
, and pick thea
inac
) will lose their tunes (the pair ofa
's formed by taking botha
's inaba
has already lost its tune). It's obvious that each tune is removed exactly once, since at the beginning no letter is in a string with any other letter, and at the end every letter is in the same string. It remains to show that each tune does contribute exactly 1 to the accumulative cost.Consider f(s, c) × f(t, c). Look at each occurrence of the character c in s, and another occurrence of the character c in t. They have a tune between them (because they haven't been merged). There are f(s, c) × f(t, c) ways to pick this pair of c's, and so f(s, c) × f(t, c) tunes as well. All these tunes will be lost when they are merged, and it costs the same amount to merge them. Summing over all c proves the claim.
Now that we have shown that we can compute the minimum accumulation cost of a string from just counting how many times each character appears. If there are n of a character, then they have tunes among them; simply sum over all characters to obtain the accumulation cost.
Now, constructing a string is easy. Just take n as large as possible while keeping ; now we have n
a
's. Subtract k by and set that as the new value of k. Take n as large as possible again; we have nb
's. Repeat until we're done. For k ≤ 100000, it can be proven that this greedy strategy works (it's impossible to have k > 0 after using all 26 letters).Problem C is shit: simple idea, but difficult implementation. And with TL like this it's not obvious what will/will not pass...
Am I the only one who thinks like "I saw many problem such like this, but I always couldn't come up with idea on this type of problem (simple range query, but also update) so I can't solve this." ?
It's no rocket science to realize that nlg^2n will pass :D
My solution (segment tree of treaps) didn't pass.
I also hate when my sln is rejected for constant issues, but.. Man, nlg^2n is <30M by rule of thumb, and my lazy solution runs in 1.45s. Not to mention that there was several n^1.5lgn AC solutions — it's too much for authors to consider anything which is even slower than n^1.5lgn solution.
And tbh I'm not surprised to hear that segment tree of treaps don't pass..
But it does :-)
29988051
WTF, it was?
we are in div 1 :(
Am I the only one who was stuck on div2 A for a very long time?
Me too. I was feeling so stupid the whole time.
In 2C cannot we do it as {1,3,6,10,15,21...} and find n as a sum of elements of this set?
yes, it turns out that the order of merges don't matter, and we can consider merges of different characters separately and sum at the end so this approach works. The proof of the above claim stems from the identity
please help me :( my code got MLE on first test (D div2) but I didnt use much memory on it.
http://mirror.codeforces.com/contest/849/submission/29990097
Harder round than usual.
How to solve Div2(B)? Any ideas?
maintain a map of slopes.
Is there an easy solution for C? I came up with a that I can't finish coding in 30 minutes (probably 200 lines of code).
Hope my solution doesn't FST...(upd: Passed System Test!)
For any two points i, j that ai = aj, if there doesn't exist i < k < j that ai = ak, then we create an interval [i, j]. The query just asks the sum of lengths of all intervals that lie in [l, r], and update changes O(1) intervals.
Let's take an interval [l, r] as a point (l, r) on the 2D plane, and its weight is r - l. A query [l, r] asks about the sum of weights of all points (x, y) that l ≤ x, y ≤ r.
You can write a DS that supports add/delete 2D points and 2D rectangle sum query. I used Fenwick tree + balanced search tree. The time complexity is and space complexity is .
As long as you know how to code 2d segment trees, it is. Consider the points of coordinates (prev[i], i) with values i — prev[i]. In one query (L, R), you're interested in the sum of the values of the points with L <= x and y <= R. When you modify a value, at most 3 prevs change
90 lines only 29981295
Am I the only one who took 20 minutes in C to avoid using map with 2d fenwick tree (and didn't succeed)? I had a solution involving any sort of 2d segment tree and didn't know how to properly code it (I though of offline solution that would normalize stuff), but any implementation has, besides the log^2 complexity and extra log or pretty big constant (maybe if we use instead of map some better hash). So, I wasted time and got nervous, but at least I can learn something out of this experience. Can anybody tell me how to properly code 2d segment trees so that you don't need an extra log or hash to access memory spaces? I do know how to do that with a segment tree with binary search trees (treaps more precisely) in nodes, but that is neither elegant, nor constant-friendly:))any help?
fenwick tree is superfast and it was likely that it would get accepted (and it did :)))) btw, even n sqrt log with fenwick gets accepted here
so i think there was no reason to get nervous as TL was pretty big
Is int32 (int in C++) enough for problem B div 2 ?
Yes, int = 2^32 = 4*10^9
Isn't max_int in C++ 231 (one bit of memory for sign)? The coordinates here can be negative. Either way, it should be good enough.
Sorry for my non-clear question, because I think everyone using pair of fraction. But as I see, people use double instead. So I wonder if using fraction to store, could we get integer overflow for multiple operation.
If you do all operations without double, then long long is safer.
Why div 2 B ? ...
My first div1 contest and i think i'm going back to div2(((
Don't worry, you are safe:) your new rating is 1916
Failed on tests 5 6 7 8 9
Hacks for Div. 2 A and B?
Div2a
6
1 0 1 0 0 1
Answer is no.
For Div-2 A, even this code (surprisingly) passes Pretests, so ez hack is:
n=3
anda=[1,3,4]
.In problem A my code passed pretests without handling the n=1 case. (Luckily I noticed before getting hacked)
ODDS&ENDS by. supercell ( ryo )
Tell Your World by. 8 Prince
From Y to Y by. OneRoom
Rooter's Song by. DECO*27
Goodbye Souvenir by. Toa
Miku is the best.
shake it! by emon(Tes.), and Hanairo Biyori by Natsume Chiaki
Am I the only one who found Div2 C easier than Div2 A and Div2 B??? :|
I think div1C can be solved in this way in O(nlogn) but I suck at implementing it — spent 90 mins and got nothing. :(
The answer of each query is equal to the accumulated value of nxt[i]-i for l <= i <= r where nxt[i] is the smallest value which satisfies a[nxt[i]] == a[i]. (Let nxt[i] = n if there is no candidate for the sake of implementation), minus nxt[i]-i the rightmost elements of each values
nxt[i]-i can be maintained with a trivial fenwick tree.
Denote red[i] to be the sum of values to be reduced for queries [l,r] where r == i, this value could also be maintained with any range structure. (Just increment red[i..nxt[i]] by nxt-i)
My buggy code for the brief idea: https://ideone.com/NPDI0p
Edit: Nvm, I think it fails to handle elements which are not contained within the query range
I think it won't work because "minus nxt[i]-i the rightmost elements of each values" don't really match with red[i]. (didn't see the implementation, so I might be wrong)
It feels good when System Testing is so fast =P =D
Super fast system test! Great!
It seems that there are many solutions and complexities in Div.1 C.
Which complexity did you use?
I have an impression that when score distribution is like "x-y-1750-1750-z" or "x-y-z-2250-2250" it almost always turns out it would have been better to have standard one. Like this contest or here: http://mirror.codeforces.com/contest/830
Auto comment: topic has been updated by cyand1317 (previous revision, new revision, compare).
A moment of silence for those who solved A then jumped to C but couldn't finish debugging it on time :(
When ur python code can't perform 1e6 operations in 2s and gives TLE :(
Python should be able to perform around 107 arithmetic operations in 2 seconds. Your solution might be inefficient. (For example, did you know concatenating strings is ? If you concatenated so much, your estimation of the number of operations might be off. It might be something like that.)
I am talking about div 2 B.
I beleive this is O(n^2) only with n <= 1000. http://mirror.codeforces.com/contest/849/submission/29979940
It does look like it's O(n2). Perhaps you're just rather unlucky; you might need to find a constant factor speedup (making the constant in O(n2) smaller). (Note that tests 18-19 have n = 1000 and you passed in around 500 ms.)
yeah. #sed_lyf
very surprising. my C++ code 29984431 which is also passed in only 15ms.
You can try submitting in PyPy, it runs a lot faster.
I must say, extremely bad problemset. Would require one hell of a disinterested person to write such bad problems.
Very true
EDIT: The editorial is already up, wow. Well, I'll leave it here anyway.
I didn't come up with a complete solution for Div1D, but this is my idea:
For convenience, suppose a change involves the edge (u, v), and vertex w and edges (u, w), (w, v) are added. Then we say w is built on top of (u, v). We also say (u, w), (w, v) are children of (u, v). We say (x, y) is a descendant of (u, v) if (x, y) is a child of a child of ... of a child of (u, v) (with any positive number of levels). Let cut(u, v) be the minimum (u, v)-cut in the subgraph made of (u, v) and its descendants, minus 1 (the edge (u, v) itself). This minus one make things much cleaner.
First, suppose u1, u2, u3, ..., up are all the vertices built on top of (s, t). Then ; this can easily be proven by induction (and the base case itself is easy to see: either you cut from s to u1, or cut u1 to t).
Given this, we can use dynamic programming to solve it. An attempt is to set dp[n][m] to be the number of possible worlds where there are n changes and cut(s, t) = m. (Since we don't count (s, t) itself in cut(s, t), given input n, m our answer is dp[n][m - 1].) If we could somehow take care of the similarity condition, this would work:
The similarity condition makes things hard, however, since we need to take care not to count the same thing twice. As an example, suppose n'1 = n'2, n"1 = n"2, m'1 = m'2, m"1 = m"2, and yet the subgraph built on top of (s, u1) or its descendant, say H, and the subgraph built on top of (s, u2) or its descendant, say H', are different. Then we will get another valid graph by swapping H and H'. This gives the same graph, but our naive DP algorithm will count them as different. So we need to take care of that.
My solutions for the problem is perfectly okay but they were rejected during the contest for no reason.
Look at the two solutions below 2991746, 29991714 the only different is at line 153.
Everything is exactly the same. Even the output is same.
Can anybody explain?
It seems that p(x) prints an extra trailing space.
29991794
This is a solution, with extra space that gets passed.
Perhaps in practice the checker is not so strict.
It seemed to me that p() prints
\n
only. As your wrong answer states, the verdict iswrong answer Line "o " doesn't correspond to pattern "[a-z]{1,100000}"
You may observe that there is an space aftero
... So I went to look at the code when n = 0, and turn out thatp("o")
is different fromcout << "o"); p();
TL;DR: A single space hurts :(
p("o") prints a new line too.
I print extra new lines all the time. This has never happened.
Output for
p("o");
iso \n
; andoutput for
cout << "o"; p();
iso\n
.So the only different is really the space. I think the checker this time is strict tho, as normally the checker would trim your output first...
The difference is that you are printing an extra SPACE in the second code. But I agree that this shouldn't be a reason to get WA if the rest of the code is correct.
Nice problems!
super contest !!!
I got AC on Div. 1 D after contest (I couldn't get it to pass during contest because I wasted time on Div. 1 C). Here's my solution :
Let dp[i][j][k] denote the number of distinct graphs that can be formed after applying the operation i times so that the max flow is j, and k is something we will describe later. We iterate through x, the number of times we use the edge s-e to construct a new vertex where k flow will flow through it. Iterate through y, the total number of operations spent on this part of the graph (the current edges and all the edges that will occur after it). We need to find the number of ways to use y operations to create x pairs of graphs of the same type such that for each pair of graphs (A, B), the minimum of max flow of A and the max flow of B is exactly k. Suppose we know the answer to this is X. Then, we can increment dp[i - x - y][j - kx][min(j - kx, k - 1)]·X to dp[i][j][k].
Let dp2[i][j] denote the number of ordered pairs of graphs (A, B) we can form such that the minimum of max flow of A and the max flow of B is exactly j and a total of i operations are used. Then, we can iterate through all k, denoting that we use k operations to form A, and all pairs (l, m) with min(l, m) = j and add dp[k][l][l]·dp[i - k][m][m] to dp2[i][j].
Finally, let dp3[i][j][k][mx] denote the number of multisets of ordered pairs of graphs (A, B) we can form such that the minimum of max flow of A and the max flow of B is exactly j and a total of i operations are used, assuming that we can only use at most mx operations for each pair of graphs. Iterate through l, the number of pairs where we use exactly mx operations. Let C = dp2[mx][j]. There are C ways to choose one pair, and we need to choose l pairs, possibly with repetitions. The number of ways to do this is by the balls in urns formula, and this value can be computed in O(n) time since l ≤ n. Thus, we add to dp3[i][j][k][mx]. We can use the value of dp3 to find the X we need for dp above.
I know Div1C
N * sqrt(N)
solution but I did not have time to finish writing it :( OffensivelyWTF!!
It's like game of thrones. The more you have, the easier you can lose it!
All my solutions were "skipped" and I was not given a contest rank.I did not plagiarize any code from anyone ....
maybe you used some public online IDE like ideone and someone copied and submitted that code before you did!
Ya i just realised that. I hadn't privated my code on ideone. Pretty damn unfortunate .....
Bad luck. Solution for A and C was correct. If these two got rated then.... Alas! they got skipped.
I think my B was rit too cause i got AC in the system test round and then it later got converted to Skipped. But i guess ders no use crying over spilt milk....
Bad luck. Solution for A and C was correct. If these two got rated then.... Alas! they got skipped.
I'd like to have my solutions skipped... =)
Nice problems!
can someone tell,why WA it's working for the same input on ideone — http://mirror.codeforces.com/contest/849/submission/29996525
You are setting the flag to false when the endpoints are odd, you need to set the flag to false when they are even.
Run the same code in custom invocation, you'll get "yes" instead of "No"
thank you ♂sir
昨晚有点崩,本人hack了,以后一定要稳定心态,加油!
Good luck next time!
Also, on CF people write English so that everyone will understand. You can translate it.
hhhh thanks!
Dongda District so many people want to play codeforces, but only the middle of the night to play, hoping to like that last night that time, or later can, or every time the second day of class are listless.
Auto comment: topic has been updated by cyand1317 (previous revision, new revision, compare).