<almost-copy-pasted-part>
Привет! В Feb/04/2020 17:35 (Moscow time) начнётся Codeforces Round 617 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 или 7 задач (или 8), которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.
Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Я постарался сделать приличные тесты — так же как и вы буду расстроен, если у многих попадают решения после окончания контеста.
Вам будет предложено 6 или 7 (или 8) задач и 2 часа на их решение.
Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.
Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:
- принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
- не иметь в рейтинге точку 1900 или выше.
Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.
Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацию моей работы. Спасибо моим очень хорошим друзьям Дарье nooinenoojno Степановой, Михаилу awoo Пикляеву, Максиму Neon Мещерякову и Ивану BledDest Андросову за помощь в подготовке и тестирование раунда.
Удачи!
</almost-copy-pasted-part>
UPD: Разбор опубликован!
Good Luck to all participants!
so sad that people downvoteing :/
why is it sad?
I hope I will be able to do more than 1 problem this time xD
Честно говоря мне очень нравится Div.3 раундах особенно когда создатель vovuh или pikmike
I know there is a Points Penalty of 50 points but what is the Time Penalty all about?
Educational CF Round and Div.3 Round have no points penalty. Instead, they have time penalty, which depends on the time when a participant submitted correct submission and the number of wrong submission. In detail, if you solved problem k minutes after the start of the competition, your solved problem number increases by 1, and your penalty increases by 10×(the number of wrong submission on that problem)+k.
Looks great! Maybe this is the round when I finally become rated. ;O
Why are you so eager to become green?
Because It is there.
you can't because this contest is only rated for trusted participants. And the criteria being trusted is
and you didn't participate any contest till now.
Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.
I registered when I was cyan (during previous Div.2 contest) and now my Handle in registrants list doesn't have a star(*) next to it . Is it gonna be rated for me and people like me or not ? If yes I hope you fix it cause I don't think it's gonna be fair this way.
you can deregister yourself by going to the registants page and click the red x button :D
Come on!!!
Can my rating increase or decrease if I am an unofficial participant and I take part in this Div3 ?
nope
OK,I know. Thank you!
Vovuh and Codeforces div3 rounds.
Please upvote my contribution lies in -30
)
i think anyone can't write div3
what about the score distribution?
Div 3 and Educational Rounds don't have score distribution.
They have penalties on time
What is score distribution?
All problems score is same. which is
A-B-C-D-E-F-G
1-1-1-1-1-1-1
getting negative recent vovuh's contest
I am late some minutes. Is it not possible to register after contest has started?
I am not able to submit :/
Can we hack any solution in this contest ? When does it start ?
The hacking phase starts after the contest ends.
How to solve E?
Solution for $$$E2$$$:
Firstly observe that the question asks to use minimum number of colors such that subsequence formed by each color is sorted.
Consider the longest decreasing subsequence (LDS) of the given array. Observe that no two elements of this sequence can be given the same color, hence number of colors must be greater than or equal to the length of the LDS.
Now, to find a coloring with number of colors equal to length of LDS, let $$$lds(i)$$$ denote the length of longest decreasing subsequence which ends at $$$i$$$ and includes the $$$i$$$th element. Observe that if $$$a_i > a_j$$$ with $$$i < j$$$, then $$$lds(j) > lds(i)$$$. Importantly, $$$lds(j) \neq lds(i)$$$. Thus, you can just assign the $$$i$$$th element the color $$$lds(i)$$$.
But LDS will take n^2 time right?
No. You can find LDS in $$$O(n \log{k})$$$ where $$$k$$$ is the size of the alphabet using binary search/fenwick tree/segment tree. Even a simple $$$O(nk)$$$ algorithm will work for this problem. Search online for LIS solutions.
Nice construction. Thanks!
By the way, how did you come up with this LDS construction. It seems so..... exotic. It's really very nice.
Had you encountered a similar problem before, or did you come up with the solution from scratch?
No, I just happened to stumble upon it.
You can also just check that a letter can't be assigned to the same color of any letter that has greater value and appears before (it is an inversion). I assigned bitmasks to every letter and every mask will have a bit of the corresponding color active if there is a letter that was already assigned to that color.
What's the reason 70267449 'Compilation Error' in C++17 but the same 70270849 worked on C++14 ?
Name collision with data function, which was added in c++17
There's a template function in c++17 names "std::data", which makes your data variable ambiguous
I signed up for this div3 before the score reached 1600.Can anybody tell me that Will I be rated in this situation?Thanks~(I didnt find the star '*' beside my name during the competition)
STLforces :)
Can someone explain to me how does the Test Case #1 for question-d is correct?
I keep finding 6.
You need 2 tricks for 10 and 50 (10-2-3-2-(?)-2-(?)-2), same mechanism for 50. So you can't have 50 and 10 simultaneously
Thanks.
Now it is clear.
first , fourth and fifth monster can be killed without secret technique . Last monster can be killed by using technique once and rest of the monsters can be only killed using technique twice .
GreedyForces
CodeGreedy
My rating is less than 1600 now, but why I'm not in the official standings of the contest?
May be you have not registered for the contest...
Maybe you have not registered for the contest... Sorry commented again
You were expert, the time you registered for the contest. So you are out of competiton.
hello I'm new to CF great problems! I like E2 and F very much
Fun fact: if you change statement of E2 so that you have to color all occurences of a fixed letter the same color and let alphabet size vary, you get an NP-complete problem by reducing to graph coloring.
UPD: no, that's actually wrong. Reduction I was thinking about was associating every vertex a single letter and then finding some permutation such that the graph is what you want. But that is wrong: there are $$$ n! \sim \sqrt{2 \pi n} \left(\frac{n}{e}\right)^n $$$ permutations but $$$ 2^{C_n^2} $$$ graphs and there is no way to have a surjection.
What is wrong with thislink for problem A(div3).
5
2 2 2 2 2
check this case
my solution to C
can anyone tell why this fails on test case 6? I transformed the string into integer array and used greedy approach to find the smallest sub array with 0 sum.
Using +2 for "UP" and +1 for "RIGHT" means that your program thinks "ULL" is a net-zero sequence of moves. You could do some approach like this, if you did +N for "UP" and +1 for "RIGHT", then there would be no ambiguity because it would be impossible for enough L's to cancel out a U. Or you could just keep track of the sum into two parts, a netVertical and netHorizontal.
but i am never considering odd sized subarrays, I am only checking for even sized subarray starting with 2, hence, I will never check for ULL.
See nathan_drake 's example, even if it is even, you can still fall into that situation
1 6 UULLLL
just replace 2 with 10^6 but your code will still be tle, try hashmap, changed solution of yours it passes test case 6 my solution with hashmap with linear time complexity
Спасибо мне очень понравилось! Интересные задачки! Thank you, I really liked it! Interesting puzzles!
I didn't solved a single problem, I feel so dumb right now...
everyone didn't solved a single problem at the first time... cheer up man practice hard and get ready for the next contest.
@Ernis In the Codeforces Educational Round #81, I am also not able to solve a single problem. But in this contest, I performed decently. So just compete and don't give up.
Try to upsolve problems after contest has over ..its better for U
Are there some extra spaces in Test case 6 of problem C? Using s.length() in C++ was giving runtime error while replacing it with n gave wrong answer.RE WA
may be the run time error because s.length type is unsigned integer so when the length is 0
1 — length equal to unsigned integer max not -1
input string is not empty as n is greater than 1
i mean this s.length()-4 in your code
Print s.length()-3 and check the value then your questiom will be "how it passed 1st 5 cases?"
can we solve E1 by using bubble sort to generate a graph where there is an edge between two letters if we have to swap them, then check if this generated graph is a bipartite graph ?
How to solve F?
Sort the query asked by passenger in increasing order of minimum distance in path.
now let for query(a,b,g) if i already assigned all edges with cost less g and assign all edge in path from a to b with g(if any edge is already assigned with less cost then reassign it with g) then minimum cost for a path can't be less than g. Since i am assigning the cost in increasing order then it might be the case that minimum cost in path from a to b can be greater than g(let after reassigning all edge with cost>g). So assign cost to all edges that come in path for every query in increasing order of cost and after processing all query check the minimum cost for every path in query if it doesn't match then there is no valid answer. if every query matches then we have the answer.
here is my submission
I solved it in O(n^2) but i am curious to know any soln with less complexity.
Check it here
tmwilliamlin168 solutions for div 3
please give idea to solve C & D
For C
Store the current location while iterating you can begin at (0, 0) increase the values accordingly for L, U, R and D
Store the last seen locations in a map or set and when you reach a point you've seen before check if the distance between the current index and index of where you last met the point is minimum and save it as your result.
For D
Calculate the number of tricks (the secret technique) you will need to gain points from each monster ignore if 0 (add 1 point to the result since you already earned it) sort the other trick values and pick from the minimum while k is sufficient
You will need a trick if h mod (a + b) = 0, you need exactly ceil(b / a) tricks for that
Or if h mod (a + b) > a let's call the remainder rem you need exactly ceil(rem — a / a) tricks for that.
Round has ended recently and now I'm really can't explain why my E2 solution works
Interesting experience :D
70254356 Why doesn't this solution end up in TLE? If we consider the number of operations it should be slow. I tried the same solution in GNU C++ 17 in custom invocation and this solution ends up in TLE but in MS C++ 17 it passes easily. Is there some kind of optimization in MS Visual C++? What am I missing here?
Interesting, if someone could throw a light it'd be great.
.
So someone replaced D with C .
so D is easier? :D
YUPP
How to solve E using graphs ??
I feel that C was comparatively difficult than D.
but I felt D was slightly difficult
What is the hack case is F? pajenegod
UPD : It TLEed
I was doing TLE hacks. In the end I was able to hack more than $$$100$$$ submissions with the same hack. My test was just to construct a tree in the form of a line, then do queries from one end to the other with weight $$$10^6$$$. To make the queries a bit heavier I made all the labels random and never asked the same query twice.
One fun thing to note was that my test case hacked the checker for the problem.
I've seen my hack take $$$46$$$ ms submissions to $$$1.3$$$ s, so my test was far heavier than the original test cases. Honestly the reason why my hack was so effective was because the original $$$267$$$ test cases were really sub-par. Not only did they not test the obvious max case, there were also obvious patterns in the data. For example if you made node $$$1$$$ be the root, then
parent[i] < i
in every single one of the original $$$267$$$ test cases. dorijanlendvaj noticed this pattern after I showed him a $$$46$$$ ms submission that I had made TLE. He figured out that the code got stuck in an infinite loop ifparent[i] > i
, which never happened in the original test cases.Honestly, I did not expect such weak pretests.
Don't know about you guys...For me this is the best contest ever...
Why are some experts getting rated ?
Proof
My submission was TLE on System test. https://codeforces.me/contest/1296/submission/70275201
I submitted same code and got AC. https://codeforces.me/contest/1296/submission/70355834
Does this happen often?
It happens often if your solution runs closer to the TL. Runtimes can vary quite a lot (maybe up to 200 ms), but usually 30-60 ms.
Just so you know, you could have just done
c[x,y]
instead ofc[str(x) + "," + str(y)]
dantrag pajenegod
Thank you for your reply. I would like to write optimal code.
in question C for 3rd division cant we use prefix-sums and check for sum of 'L' & 'R' for size 2 and sum of 'L'+'R'+'U'+'D' in the string and print the index where we get it.... what is wrong in this approach!!! on which edge case it might be wrong!! please help
The cycles can be not only of length 2 and 4.
Correct answer is
1 8
.thankyou so much
Hello, could someone help me check my submission for problem F? It got time limit exceeded on test 271. I already check it in my computer with a line graph, and it is slow (took around 7 seconds). I have no clue why it happened. Submission link: https://codeforces.me/contest/1296/submission/71952020. Thank you!