Hi all!
This weekend, on Oct/06/2019 18:05 (Moscow time) we will hold Codeforces Round 591. It is based on problems of Technocup 2020 Elimination Round 1 that will be held at the same time.
Technocup is a major olympiad for Russian-speaking high-school students, so if you fall into this category, please register at Technocup 2020 website and take part in the Elimination Round.
Div. 1 and Div.2 editions are open and rated for everyone. Register and enjoy the contests!
The Elimination Round authors are BledDest, MikeMirzayanov, Neon, awoo, Roms, adedalic and me. This round would also be not possible without the help of our testers: KAN, chemthan, gisp_zjz, Kallaseldor, Jeffrey, danya.smelskiy, Juve45, thank you so much!
Have fun!
UPD.
Unfortunately, the round is unrated.
gisp_zjz Liu HongYang niubi
Why arsijo?
I hate Codeforces Round 571 (Div. 2)
Why can't arsijo ?
That's only a mistake of a contest.
Oh,come on. Let's enjoy this contest!
let's just hope we dont get 20 minutes long queues
A worth-joining contest to end my boring week incredibly <3 <3
Get a girlfriend bro
Tomorrow is my girlfriend's birthday anyway :> ~~ An incredible week is cominggg
Hmm nice :). I pray i get one too (^_^). I'll confess to my crush after this contest!!
We'll be waiting for your success story then, not heard one in a while. All the best!
may loveforces be with you :D
Hope that we are not going to be punished with long queues
Just for not thanking MikeMirzayanov for this awesome platform. XD
Even worse this time! xD
Let's hope for clear problem statements
Kindly, after the contest, up-vote this comment if the contest was good, down-vote if it was bad, do not vote if it was mediocre.
I am from the Future The contest will be good and your comment will have many downvotes.
And you are going to get more up-vote Mr.PaPaSmurf
And you are going to get no votes MR.Mujahid
Maybe you are from different universe
Why same question every-time when it is mentioned in the description !
It's how who writes this question look like
.
All the best Happy Birthday!
It's going to be my first div.1 contest, so excited for that!
Your rating graph is so beautiful.
All the best.
what is rule of contest? ICPC or Codeforces?
hope arsijo remember the contest he last conducted which was a heck
What will be the Scoring Distribution, no of problems etc ?
Will be announced later.
Time to go IM
Failed.. OTL
"All you bug are belong to me" — or how to open problems?
"Independent" QueryForces!
*Me after solving A, B and C
"Let's go to comment section"
i guess its an unrated contest because of long queue and not being able to access cf
I am not able to submit for last 15 minutes!!
30 mins for me
I should be unrated
Go To Hell DDOS Attacker (The Problems Were really nice )
Unfortunately, we had a DDOS attack during the round. Codeforces did not work for a few hours. Obviously, the round will be unrated. Also, there will be an additional Technocup Elimination Round.
.
good
Seems like Codeforces is working again <3
This DDoS attack is such a shame, because the contest was quite nice in my opinion. Do we have any idea why would someone do that? (Or if it was a DDoS and not some other issue)
Someone who would lose a lot of rating
"Nice round"
I was doing so well in this contest! :( So angry at the ddos attacker. Hopefully the next round is soon.
I would like to submit it quickly. Korea is dawn, but I can't sleep because I wonder the answer is correct. :X
Wrong Answer i go to sleep :D
F*ck you ddos attacker btw How you solve div2- C ?
Binary search, I guess
Can you please explain ? :)
Basically you binary search for the minimum length you can get
And to test if a length is ok
You place the maximum ticket prices at positions where both programs occur i.e. positions divisible by both a and b then the next batch of maximum ticket prices go to positions divisible by a if max(x,y) equals x or b if max(x,y) equals y and the last batch of maximum ticket prices go to positions divisible by a if min(x,y) equals x or b if min(x,y) equals y
It's wrong. Get value sequence from 1 to d such that d minimum. not any value @@
NeiH I don't understand
Can you explain a little more?
btw I just submitted and it got accepted
your solution is actually correct
Yes
I just looked at it again now
Thanks Zergrush
Binary search on the number of tickets you will use. You can easily see that if the problem is solvable with k tickets, then it must also be solvable with k+1, and if it is unsolvable with k, it will still be unsolvable with k-1.
To check if the problem is solvable for a given K, you have to use the k/lcm(a,b) most expensive tickets on the lcm(a,b) positions, the next most expensive ones will be used for the remaining a and b positions (if x > y use the a positions first, else use the b positions first). This guarantees a maximal value to help the environment.
you can use binary search. first sort the array the then we assume that we need to sold mid ticket and for valid mid we use binary search and in check function u can implement that if we sold the mid number of ticket than profit is more than we reduce right by mid-1 otherwise we increase left by mid+1. At last our answer is mid. you can see the my solution https://mirror.codeforces.com/contest/1241/submission/62071599
NO.. It's greedy
U can do binary search
Give me your solution
My solution using binary search: Code
I solved it with greedy we need to maximize sum we first take maximum values for (x + y) after that we take values to maximum of x and y and then to minimum of x and y
btw i solve it with Greedy and my solution complexity is O(N)
so for my solution i put the 3 possibility of discount into a vector in order to ignore i-th index which has no discount:
x+y
max(x,y)
min(x,y)
and then i sort the ticket price descending.
for each iteration i mark where's the ticket price goes (3 possibility of discount) by putting it into queue.
if at i-th iteration the discount is min(x,y) just add the value and put the index into a queue.
if at i-th iteration the discount is max(x,y) we move the ticket price at min(x,y)'s queue to max(x,y)'s queue and put the current ticket price in min(x,y)'s queue since the current ticket price is lower than previous ticket price (sort descending)
if at i-th iteration the discount is x+y we move max(x,y) to x+y and min(x,y) to max(x,y) and current to min(x,y)
example:
ticket price : 300 200 100 100
discount : 1 1 2 3
and here's how the ticket price move for each iteration
source code: https://mirror.codeforces.com/contest/1241/submission/62074247
PS: STL sort is O(n log n) so technically your solution isn't O(n)
Suppose x > y, and the number of tickets sold (call it L) is known in advance, and we just want to know what the optimal profit will be. Let lcm be the least common multiple of a and b.
Then the best strategy would be to place your most expensive tickets on multiples of lcm (since this gets you (x+y)%). You can compute how many of those there are in constant time (there are
L/lcm
of them), and you can use a cumulative sum array to compute the total value of all the tickets in that range (sort the tickets by descending price and sum from 0 to L/lcm). Similarly, place your next most expensive tickets on multiples of a (there areL/a - L/lcm
of them), and your least valuable tickets on multiples of b (there areL/b - L/lcm
of them), and use the cumulative sum array to get the profit. After you have these quantities, you can compute the total price and compare it to K to see if it satisfies the problem requirements.Now you want to know the minimum L. You can binary search for L, or (since the bounds are low) just do linear search. If you didn't implement the previous paragraph in O(1), you probably need binary search for this part.
After putting the maximum priced tickets for x+y shpouldn't we consider a and b along with x and y too? Suppose a is very small so its frequency will be more so won't the optimal way would be to use x because of that even if y>x ?
I had a pretty stupid solution. First sorted the list then used 3 queues for type a and b and both. for each length the sum is updated in O(1) with at most 3 push/pops. 62028584
I submited 4 times. -150 points and get last time @@??? why
If same code is submitted, its not a problem. Why did you keep changing code?
I use to sv 3 and not show after i submit @@.
How to solve div2-D?
I submitted bottom-up DP. We can show that any element will be moved at most 1 time. So there is exactly 3 options. We either move it to the beggining, move it to the end, or don't touch it. So it's DP[N][3], with DP[i] = minimum amount of turns to sort the first i elements, and [0..2] to denote those 3 options.
Thanks. Nice solution!
can u please explain why dp[i][1]=i in both cases. and why dp[i][2] is same in both cases
Let's say [1] means move ith element to the left and [2] to the right. If we move ith element to the left, then it will become leftmost element in our array. In that case, the only possible way to sort the first i elements (considering we won't move ith element anymore) is to move the first i — 1 elements to the left, using exactly i turns. And if we move ith element to the right, then we don't care about how we sort the first i — 1 elements, because ith will become the rightmost element, thus it will be the same in both cases.
got it!! nice solution
Unlucky arsijo... Why problem occurs (!) always in his round?
why the blog doesn't thank MikeMirzayanov to the platform codeforces, maybe this is the issue xD
the statement of the problem Cdiv2 could be shorter . :)
i know you probably worked on the statements and you may have a purpose .
it was just an advice to shorten the statements as much as you can. :)
We need a version of this pic with Mike + CF coordinators. Not just cut+paste in Paint, but some decent work.
Looks like a few people do not see some of their submissions. We are investigating the issue.
It refreshes only once in Chrome.
Hope upcoming educational will have nice problems as well!:)
Problem D is very similar to one task from CSAcademy (the only difference is that the given array was a permutation in CSA, but is doesn't really change the solution).
It feels like every rounds kinda DDoS attack, but this time bigger.
In div 1 F, are these random solutions hackable? 62022214 62023134
I Was enjoying this round so much that I was reloading every now and then to see the problem getting resolved and never lost hope! Hard Luck arsijo!!
arsijo in your last 2 round, you forgot to thank MikeMirzayanov for platform and polygon. then both of this rounds became unrated !
How to solve div1-D?
arsijo's rounds are always unated!
Why are submissions and testcases kept hidden??....Or is this something, only I am facing??
It's probably the most upvoted unrated round.
Can someone someone explain problem E (definition of K coloring)?