Hello Codeforces!
On Apr/12/2021 17:35 (Moscow time) Educational Codeforces Round 107 (Rated for Div. 2) will start.
Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.
This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.
You will be given 6 or 7 problems and 2 hours to solve them.
The problems were invented and prepared by Roman Roms Glazov, Adilbek adedalic Dalabaev, Vladimir vovuh Petrov, Ivan BledDest Androsov, Maksim Neon Mescheryakov and me. Also huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.
Good luck to all the participants!
Our friends at Harbour.Space also have a message for you:
Calling on all Codeforces,
Harbour.Space University is offering a unique opportunity to study in Barcelona for those who are interested in joining our young and dynamic competitive programming team. We accept medalists and top performers of IOI, IMO, ICPC, and participants with Codeforces rank above 2000.
Harbour.Space has a single, key requirement: be passionate and motivated to learn and/or work in the field of competitive programming in the long term. Even if you have already exhausted all your ICPC attempts, you are still welcome.
Join us to help build a comprehensive system of preparation for IOI and ICPC for the next generations! We believe that if you have the talent and determination to succeed, you can. We want to help you make it happen.
In addition to courses taught by some of the world's foremost experts in their fields, Harbour.Space offers these benefits upon acceptance for this scholarship:
- A full tuition fee waiver (Bachelor and Master degrees)
- Student visa
- Private health insurance
- Monthly living allowance*
In return, we demand dedication to learning and improving yourselves:
— Study three hours per day
— Train continuously for ICPC, if you are still eligible for participation
— Intern four hours per day
Ready to formally submit your application? Please register on our website, attach your latest CV, and pay a non-refundable €125 application fee. The fee guarantees we can process every single application in a fair and timely manner, and maintain the highest possible standards of assessment.
Our admission process is a holistic review of each candidate's abilities, achievements, and potential to create something exceptional.
You may choose to study in the following areas of specialization:
- Computer Science
- Data Science
- Cyber Security
- Front-End Development
All our degrees are taught in English. If you want to learn more about our programs please visit our website or contact our admissions office.
*The exact living allowance level throughout the entire duration of studies depends on the performance during the interview and on the overall performance. As a guidance, it is in the range of 500-1500 EUR.
Harbour.Space University Team
Congratulations to the winners:
Rank | Competitor | Problems Solved | Penalty |
---|---|---|---|
1 | risujiroh | 7 | 233 |
2 | Maksim1744 | 7 | 243 |
3 | noimi | 7 | 253 |
4 | fastmath | 7 | 278 |
5 | mango_lassi | 7 | 288 |
145 successful hacks and 1221 unsuccessful hacks were made in total!
And finally people who were the first to solve each problem:
Problem | Competitor | Penalty |
---|---|---|
A | Maksim1744 | 0:01 |
B | SSRS_ | 0:03 |
C | BrunoFMUFC | 0:06 |
D | SSRS_ | 0:10 |
E | AmShZ | 0:08 |
F | SSRS_ | 0:51 |
G | Potassium | 0:45 |
UPD: Editorial is out
In return, we demand dedication to learning and improving yourselves:
— Study three hours per day
— Train continuously for ICPC, if you are still eligible for participation
— Intern four hours per day
Is this a hard and fast rule or can be slack. As the above three activites consumes around 10 hours of day. Where is life?
You guys getting lives?
.
Three contest in a row in consecutive days. This is really awesome! That's why codeforces is best.
So you're going to say the opposite thing when there is no contest in 3 consecutive days?
No, not at all. I am just talking about frequency as compared to other sites.
Actually, while this is generous of CodeForces, I think it would be ideal if contests were spread out a little more evenly. I had prior commitments for the weekend and Monday and will miss 3 contests (that would typically be spread over 2-3 weeks instead of 3 days).
So you're saying that there should be less contests so you compete in more contests? I don't get your point.
5 contests over 2 weeks is worse than 3 contests over 3 weeks?
Nope, that's not what I'm saying. Rather than have 3 back-to-back contests over a single weekend, and then wait for 10+ days for the next one, it may be better to spread them a little (say over a week) so people who are occupied (over a weekend in this case) don't miss all 3 and have a chance to attend at least 1-2 of them.
Yeah ok but the next contests is in 3 days (a 5-day gap, not 10+) and the one after that is in 2 more days.
It's great that there's some more right around the corner. My suggestion was not to reduce the frequency or number of contests (the more the merrier), but to distribute them in an optimal way.
I think you mean rating, not rank
Do you do dynamic programming in the dynamic competitive programming team?
hope I remain expert after the contest :(
same here
i am on the edge
yup me to just a little above
he succeeded but we failed brother :'(
next time man it feels bad
You are giving the contest that's the best thing.
A humble request, just try to recheck the problem statement before uploading the question, for example, the last line of the first problem ( which was rectified later ) was incorrect and made the whole problem statement wrong. I was planning to give the contest but was confused reading the last line and by the time it was rectified over 6000 people had already solved it.
Yes, it was a typo in the notes, but it was fixed just about 5 minutes into the contest. We are sorry for that issue, but sometimes typos happen, and we almost always fix them quickly.
Any idea how to fix WA on test-10 for problem D?
How to solve D ?
Eulerean tour of the letters
a + ab + ac + ad .. + az + b + bc + bd + be + ...
I feel so stupid now
same
same
same
same
About 5000 people feel the same way.
It was harder for me lol cuz i did the same thing in a weird way...
aa + ba + ca + da ... + z + bb + cb + db + ... + z + cc + dc...
I done this way only check my submission
what to after "zz" but string size still less than n ?
The series will again start from "a" as it cannot be done better than this.
if k = 7, we can concan strings below aabacadaeafag bbcbdbebfbg ccdcecfcg ddedfdg eefeg ffg g and then append strings repeat.
you want to minimize occurrence of each distinct pair of letters (adjacent letters) that appears in the string , add an edge between each pair of usable letters .Then our answer is minimized if we take euler cycle of this graph ,euler cycle always exists since its a directed complete graph, each letter has equal indegree and outdegree.
I did brute force over all pairs ,$$$"aa","ab","ac"\cdots\ "zz"$$$ and greedily selected the best pair with minimum occurence.
Compleixty; $$$O(n*26)$$$
https://codeforces.me/contest/1511/submission/112864604
ya, that's what I thought of. But couldn't get to the solution.
I did the same thing but for some reason i was convinced that placing the first k characters first like (abc...k) is optimal submession
Problem D: There can be $$$k*k$$$ possible pairs of characters. Now consider each of these pairs as a vertex of a graph. Then add a directed edge from $$$c_1c_2$$$ to $$$c_2c_3$$$ for all possible $$$c_1$$$, $$$c_2$$$ and $$$c_3$$$. Now do topological sorting to find a sequence of pairs. This sequence has each of the pairs exactly once, so the cost is $$$0$$$. So, you get the maximum lengthed string which has $$$0$$$ cost ($$$c_1c_2 \rightarrow c_2c_3$$$ will become $$$c_1c_2c_3$$$). Now just keep concatanating this string until its size becomes n.
Pay attention to the Example 1's output.
Solved problem G in $$$O(nq)$$$ with auto-vectorization. My worst test works in
4305 ms
. Solution 112850106. Hope that it will stay strong during next 12 hours and later.Can someone suggest approach for B and D?
I have not given the contest. But just saw B. I think you can have many possible answers . One possible answer can be like this :
X = 100...000(a-1 zeroes) Y = 77...7000...00( (b-c+1) 7s & c-1 zeroes).
This will always give you gcd as 10..00(c-1 zeroes)
For B, I decided to assign a unique prime factor to each of a (2), b (3) and c (7).
As all the numbers (2, 3, 4) are lesser than 10, there will always be a power of {2, 3 and 7} whose decimal representation is of any given number of decimal digits.
First of all, I find c by multiplying it with 7 till I get the required number of digits.
Then, I multiply both a and b by c so that their GCD becomes c.
Finally, I multiply a and b with their respective prime factors till their representations reach the required number of digits.
Eg: 2, 2, 1
Output: 14 (2 * 7), 21 (3 * 7), 7
My Submission
how to solve E?
OEIS
can u plz tell what is OEIS?? i have heard it a lot(at cf itself) in pattern related questions.
Which sequence? How did you get there? I think I'm just really bad at looking on OEIS.
What is OEIS?
https://oeis.org/
I generated the results for 1D patterns like "o", "oo", "ooo" and so on, got an oeis sequence with these numbers, then for each vertical / horizontal contiguous pattern, I added "formula(lengthContiguous)*2^(nbWhites-lengthContiguous)"
Formula was weird, couldnt understand (I suck at combinatorics), something like "((3*n+1)*2^n-(-1)^n))/9"
logic.?
Whenever there is a combinatorics problem in one dimension, it is often the case it's formula or some related information will be available on OEIS. So find the answer for small terms and search these terms in oeis.org and you will get the formula for it.
To solve E ,
Step 1 : Try to reduce a problem to find the answer for only 1 row having N white color cells.
Step 2 : Write bruteforce and search OEIS.
Actually we can do it without OEIS using contribution technique,but yea for that too we need to come up with the observation on small single rows.... If l is the length of row,c is total white places,so the answer is sum of
2^(c-2)+2^(c-2)........l-1 times...
-2^(c-3)-2^(c-3)........l-2 times...
2^(c-4)+2^(c-4)........l-3 times...
Step 2 (alternative) by Combinatorics: Problem E 1511E - Colorings and Dominoes
Solution: 112869725
thank you so much, this is the best explanation I have found for this problem.
I just used dynamic programming (didn't even know there is such thing as OEIS) to find the sequence of the 1D o's and the equation I found was f(k) = f(k-1) + 2f(k-2)+ 2^(k-2) where f(k) denotes the total sum of the maximum tiling for a length k vertical or horizontal row of o's, and then multiplied that by 2^(nbtotal_white-k)
can you explain this "then multiplied that by 2^(nbtotal_white-k)"?
another way to solve for some n is to iterate on len of the consecutive blocks which have same color this solves for some n in O(N). my submission
Can you please explain your solution?
Ok Ill try to explain in detail, I hope you get the fact that we want to calculate answer for only a string of length N consisting of 'o' only. where 'o' can be red or blue ,so for some arbitrary painting we consider all consecutive segments of red . Now we iterate on length of this segment (you can see solve function in my code). this contributes to floor of (len/2) and we simply count how many times it occurs and add it to the answer. You can see some article on contribution technique which is what I used here.
Can someone please help in suggesting an approach for another version of problem C wherein the colours of cards and query colours can be up to 3e5?
Thank you in advance!
This submission should also work for bigger C than 50.
D is so much harder than E for me. How to solve it?
D could be solved by the pattern like a+ab+ac+b+bc+c for k=3 , and then just repeat it until you reach n . Can you tell how to solve E
Can u please help me as to how u were able to come up with this pattern.
I came up with this pattern after looking at sample test case 1 .
first of all given condition is nothing but checking substrings of length two which are repeated how many times.If you are able to observe it then your task is simply to minimize the Cost which can be minimized if two length substrings are repeated minimum times hence try to make all distinct possible two length substrings which wont be repeated if you add it to end your resulting string continue this and make your resulting string
This Video might help you. Video Explanation
How to solve E?
$$$O(nq)$$$ solution for problem G, using vectorization: 112850202.
A completely straightforward $$$O(nq)$$$: 112827572.
I understand that the my submission might be impossible to fail, but how in the world did the setters allow the second submission to pass?
Second solution is not straightforward $$$O(nq)$$$. It is auto-vectorized with GCC and has same logic as your. See assembly here. Click on cycle
for
and click on "reveal linked code".Yeah, sorry. When I was writing my code GCC didn't optimize it for some reason.
Also they have similar worst case performance, it's just that pretests are weak.
I tried several variations of your code and only a few of them passed, you can check my submission history. I guess it's easy to miss that gcc might optimize this particular problem.
Worked like half an hour on C with fancy algos, segment tree and things...before noticing that super simple simulation works fine :/
Edit: And needed some time in B to realize that the order of the two output values matters. That felt fairly uncommon for that problem.
How can we do C problem if color of cards is of order 10^5(instead of 50)?
There are max 50 colors, so max 50 positions to maintain.
Fairly SImple way to do C.
I resubmitted my problem E but the initial time of submission is shown in the standings. Which will be considered, if both of them pass?
The second one
but in the standings it shows 1:53, the time of my first submission.
I think u can see the answer in this blog
https://codeforces.me/blog/entry/4088
at "System Testing and Final Standings"
Turns out my 1:53 submission was considered. Maybe the rules of resubmission are different for Educational Rounds.
Why is my rate in offical the same in unoffical?
G O(NQ)
Well, Contest was really a good one B and D were really good problems but one thing which I observed is that in previous three contests there were overall three problems which were googleable which is a bit weird on platform like codeforces which is known for its originality.A lot of People copied code of linked list in C problem today which makes it somewhat unfair.
Linked lists :)...Lol, these people are dumb!
I think my D is different from all Please hack it. 112846805
Yes my submission is also similar to you https://codeforces.me/contest/1511/submission/112834762
Yes It seems like we have found global minima for the sequence by just considering one extra step beyond i+1th character. It is like summation of all local Minima converging to global Minima.
in question B the order of output matters , that's wrong , it costed too much
yeah , i got the idea and implemented it. It shows wrong answer i spend approx 10 min to find that order matters.
can anyone tell me how to approach A in today's contest?
Just put all the 1st and 3rd type no. in one server and 2nd type no.s in another server
14th test for D TLEd me, although on the PC it takes 0.4 sec. How is it even possible?
Most likely undefined behaviour, like an array out of bound access or the like.
awoo why this 112845193 code is giving TLE in python3.
Probably just because python isn't very fast. A static array of size 50 for all the different cards would probably work.
This reply perfectly justifies your current contribution
I think it might be due to this line
a[i] not in d
, this operation is O(n)https://stackoverflow.com/questions/17539367/python-dictionary-keys-in-complexity
Your exact code passes with Pypy 3 in 1153 ms. Worth a try next time.
(Problem-B), Can anyone tell me why my code is giving Wrong answer? Thanks. Here's the link to my code https://codeforces.me/contest/1511/submission/112825682 (Test case 228)
it will give wrong ans on 4 6 1 case .
How to solve problem C ?
You just care about the minimum index for each number from 1 to 50
Create an array of size 51 (i call it idx), idx[i] = minimum index for i in the input
when he ask for t, you put idx[t] = 1 but before changing it shift all other elements in array "idx" by 1 in case they were less than idx[t].
if you know stl it will be easy for you
you are all done ^_^
you can see my submission here
Check this video explanation
This Video Explanation Might Help you. Video Explanation
Problem C:
Python3 gets accepted, the same code on PyPy3 gets TLE :D
I listened to your advice and submitted PyPy and ended up with egg on my face
https://codeforces.me/contest/1511/submission/112854945
https://codeforces.me/contest/1511/submission/112860623
I think it is due to a bug in pypy's implementation of deque
https://stackoverflow.com/questions/13421326/why-is-pypys-deque-so-slow/13421804
It's not a bug. Not necessary a bug at least
Masters and above are in the official standings for some weird reason.
Today's contest https://codeforces.me/contest/1511/submission/112852064 https://codeforces.me/contest/1511/submission/112830325 https://codeforces.me/contest/1511/submission/112812516
Yesterday's contest https://codeforces.me/contest/1513/submission/112706259
This is how k_Rishav bypasses Plagiarism testing. He has done this today and yesterday both, and I am sure he must have done it multiple times before as well. People like k_Rishav are spoiling the sport. I don't understand where would cheating take them in life. They will never get anywhere in life but always remain what they are i.e cheater. He should be banned from the platform as soon as possible.
How to solve $$$C$$$ if distinct no of color of cards may be of order $$$O(n)$$$ ?
112861635 TLE
112862682 AC
can anybody explain this !! why using LL gives tle in B??
It might be that a>b, then the 32 bit integers somewhere overflow and the loop terminates, but the ll do not overflow.
Someone hack my solution for C, it should give RTE verdict
You can hack your own solutions
i forgot to use fast i/o in problem C. now i'm wondering if i'm gonna get tle
How to prove correctness for the approach used in D?
So the cost of the string is the sum over $$${occ[ij] \choose 2}$$$ where $$$i$$$ and $$$j$$$ are characters from $$$a$$$ to $$$z$$$ and $$$occ[t]$$$ is the number of substring $$$t$$$ in the given string $$$s$$$.
You can prove that if $$$x \geq y+2 $$$ then $$${x \choose 2} + {y \choose 2}$$$ is greater than $$${x -1 \choose 2}+{y+1 \choose 2}$$$. Then consider an optimal string. The difference in the occurrence of the maximum and minimum should not exceed $$$1$$$. With this information and the value of $$$n$$$, we can uniquely determine the maximum and the minimum number of occurrence over all substrings. This paves way for a simple cyclic construction.
I understand that we want to spread occurrences of each of the k * k substrings as evenly as possible, in that case, the string of maximum and minimum occurence will differ at max by 1. But how to construct it? Some answers said that we can take an Euler tour over the complete graph, but I don't see why it works? Can you explain that?
oh the construction is pretty simple. No need for euler tour. Let's say consider first f letters. You can consider this pattern:
faabacadaeafbbcbdbebfccdcecfddefeef
you can cyclically iterate through this string, as you know that the difference between the max and min will be not more than 1 at any time, when you cycle through this pattern.
Can C be optimised brute forced? I don't see the complexity going beyond O(50*q)
Yes. It is. subash23, Look at this submission : https://codeforces.me/contest/1511/submission/112800822
Yup I did exactly the same
Shouldn't it even pass unoptimized? Is the 2 seconds alloted to answer all of the queries or for each query individually? Because I think for each query O(N^2) should pass but who knows.
No, n is 3*10^5 and so is q, even n*q won't pass
I tried to hack my solution on problem D using the test case "2000005 26" and it got hacked but same test case was there in pretest as well test case number 36
https://codeforces.me/contest/1511/submission/112856095 (Hacked) https://codeforces.me/contest/1511/submission/112870279 (Accepted)
I resubmitted my solution it got accepted can anyone explain to me why? thanks in advance
MikeMirzayanov please look into this .. My code is hacked by a test case that was already there in pre-tests as well and same code if I submit now is giving AC verdict :(
Problem D, you can search the zero-cost string by testing if the current chosen letter will make an existing pair using set(notice that you also do not want to make the next position no choice, so check if the next pair is possible). 112873007
This string is $$$k*k+1$$$ long and costs 0. If $$$n>(k*k+1)$$$, we make it repeat. The reason is that every two repeated zero-cost string has exactly $$$k*k$$$ cost(every adjoint two letters have a collision). Also, observe that the zero-cost string starts with $$$aa$$$ ends with $$$a$$$, we do not want $$$aaa$$$ since it results in more appearances of pair $$$aa$$$, so we delete the last $$$a$$$ of the zero-cost string.
However, I forgot the deletion during the contest. Not clever :<
Yup did the same mistake during the contest.
Why people are getting tle in problem C?
is it because we use map?
submission (Hacked)
submission (Accepted)
I resubmitted my hacked solution and it got accepted! Please have a look!
Your Accepted solution can be hacked again. All submissions will be rejudged after the open hacking phase is finished.
Now it's hacked :)
see my submission it got hacked by a test case that was there in pretests
200000 26
https://codeforces.me/contest/1511/submission/112856095
do you know whats the reason for this? and now when I again doing it is giving unsuccessful hack
Sometimes you notice that if you resubmit your code it runs in different speed, This thing from CodeForces itself sometimes it differ in a little milliseconds
So always try to keep at least 100ms (depends on the problem) between your code run time and the time limit
But i am again trying to hack my solution with samr test case it is giving unsuccessful hack. I want to know are hacked submission also rejudged during final system testing. Is there any chance that verdict will change to accepted from hacked because its running within time limits specified
I'm sorry, Hacked solutions can't return Accepted
I couldn't prove/hack my solution for D, tried to make distribution uniform, maintained a $$$next[$$$ $$$]$$$ char array of size $$$k$$$ where $$$next[c] = c$$$ initially, started with $$$'a'$$$ and appended $$$next[prev$$$_$$$char]$$$ char and incremented it cyclically. For $$$n = 10, k = 3$$$ the resulting string is $$$'aabbccacba'$$$. Did anyone try this approach and proved it?
I did this as well though no proof.
https://codeforces.me/contest/1511/submission/112834165 failed on 7 https://codeforces.me/contest/1511/submission/112843558 failed on 13
Could someone help me to explain what's wrong with these approaches for question D?
Just using greedy to get the next digits that have the lowest frequency.
This Video Explanation Might help you. Check this
Why the brute force can pass G?
My $$$O(1)$$$ solution for B. Felt weird but works.
First i take $$$z$$$ as $$$10^{c-1}$$$ . Now $$$z$$$ has $$$c$$$ digits. I want add $$$a-c$$$ digits for $$$x$$$ and $$$b-c$$$ digits for $$$y$$$. To keep $$$z$$$ as a factor i have to achieve this by a multiplication of sum number (with $$$a-c+1$$$ digits and $$$b-c+1$$$ digits). But to keep $$$z$$$ as the GCD, two numbers used to multiply for $$$x$$$ and $$$y$$$ must not have common factors. aka coprime. But all prime numbers are coprime. Therefore i just have to find two prime numbers with required lengths. For that i precalculated these two arrays. Having two numbers for each length is sufficient.
Now answer can be calculated as,
$$$x=10^{c-1}*p1_{a-c}$$$
$$$y=10^{c-1}*p2_{b-c}$$$
Or you could notice that $$$10^n$$$ and $$$10^m+1$$$ are coprime for all $$$n$$$ and $$$m$$$. So you could do:
$$$x = 10^{a-1}$$$
$$$y = (10^{b-c} + 1) \cdot 10^{c-1}$$$
And the expression for $$$y$$$ simplifies to:
$$$y = 10^{b-1} + 10^{c-1}$$$
Which I think is a pretty neat answer!
Can anybody tell at which test case my C is hacked? thanks
Your code is slow
some cases with high constraints and a specific way to arrange the elements will hack it
why does this solution pass and no one can hack it? 112850106
Where is the Tutorial? : )
+
The system is accusing me of cheating when I didn't cheat. It says that my problem D coincides with some other person's problem D, I think because both of us had the same idea and the implementation code is really short.
My Solution
Other guy's solution
MikeMirzayanov Can you please look into this?
+
For problem C:
Can anybody tell me why these Python3/Pypy3 solutions giving TLE.
But Exact same implementation with C++ giving AC?
PyPy3 Code — 112823159
Python Code — 112824003
C++ Code — 112836141
Is my implementation is wrong somewhere, or is it a Judge (Or Language) issue?
TIA.
Quit using python if there is no bignum related problem. It is just a slow language.
Thanks. I realize this now, it is a bad solution indeed. I should have thought more optimized approach than this.
Is there a way to get full testcase 7 of problem C
There is a performance regression in PyPy project and they need it to investigate, here is the link to the issue https://foss.heptapod.net/pypy/pypy/-/issues/3437#note_157645
You should contact the problem setter for that
When ratings will get updated??
z
+1
+1
In problem D. Instead of thinking so much complex i have a simple logic...and by using this i got ac.
I though there are limited pairs of two alphabet so after some length whatever we choose this much have occurred previously. and lets say the count of any pair is X. so if any new occurence of that pair will cost x+1; So i have to minimize this X. it is inly possible if we distribute the occurence of pair symmetrically. Means first form all the pair by A then same with B,C,D...Z. until its length becomes N.
I have also done same
Why ratings are not updated yet ??
+1
It seems that many O(n^2) solutions pass problem G . Maybe 4e10 "xor" operations is very fast QwQ.
interestring QwQ
Why the title of this contest in the rating graph says the contest is unrated?
Because rating has not changed yet.
waiting for rating change
Me too.
Why the ratings don't change ?
why the ratings haven't changed?
Why is the rum gone??
Where's the beef? Why hasn't my rating changed? I stayed up late to participate in the contest!
It's normal for educational rounds, rating changes usually appear around 24 hours after the contest.
beef is banned in India
During contest I misread Problem A Review Site. I thought type 3 person will downvote if there are more upvotes than downvotes, otherwise they will upvote.
Can anyone guide me how I can solve this version of the problem.
I think it would be optimal to send type 1 guy to the first server and types 2 and 3 to second server, and then just loop through the types.
I thought the same but it actually fails for this test case -
Your answer would be 1 but correct answer is 2.
As the statement mentioned : "type 3: a reviewer hasn't watched the movie — they look at the current number of upvotes and downvotes of the movie on the server they are in and decide what button to press. If there are more downvotes than upvotes, then a reviewer downvotes the movie. Otherwise, they upvote the movie.", you can easily put all of the people from type 1 and type 3 in server 1 and the rest of them in the second server, So the answer is the number of '1's and '3's in the input array.
Please read the original comment one more time.
In your version of problem you should send the Type 1 person to the first server and Type 2 and Type 3 person to the second person and just keep a track of number of downvotes the second server has and accordingly add on to the upvotes (if number of upvotes<=downvotes and current type is 3, then the upvotes increase, if type is 3 then downvotes increase, else if upvotes > downvotes, then for each type downvotes will increase), I guess this should do it
finally after 2000 years rating changed
Hopefully Editorials will out in another few yrs XD
Auto comment: topic has been updated by awoo (previous revision, new revision, compare).
Auto comment: topic has been updated by awoo (previous revision, new revision, compare).
As a first AC, you are late AC.