We will hold AtCoder Beginner Contest 183.
- Contest URL: https://atcoder.jp/contests/abc183
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20201115T2100&p1=248
- Duration: 100 minutes
- Number of Tasks: 6
- Writer: beet, Kmcode, kyopro_friends, tozangezan
- Rated range: ~ 1999
The point values will be 100-200-300-400-500-600.
We are looking forward to your participation!
Feature request: give us the possibility to unsubscribe from email notifications about particular contests (ABC/ARC/AGC). I don't want to miss AGC and now it means getting several other emails a month.
How to solve F!
Here my code, but it gave TLE in 4 test cases
Think of small to large merge operations. For each student maintain a set of all distinct classes in his group , and while merging in dsu, take the smaller set and merge it to the larger set. Also maintain a map<pair,int> to store the answer of the queries (a,b). implementation
Disjoint Set union with 2d Map. The idea is similar to the one explained in this blog, [Explanation] dsu on trees (small to large).
Your solution's time compexity will be $$$O(n^2)$$$.
For example, '1 i i+1' for i in $$$[1, n - 1]$$$. In this case, your solution will merge a set with size i to another set with size 1 each time.
When merge two sets, just merge smaller set to bigger set, the time complexity will reduce to $$$O(n \log n)$$$.
For the first time i think F was so easy in Atcoder Beginner and also for the first time i was able to solve F in ABC. but then couldn't solve B(:.
B was so easy, even I solved it with some trigonometry :P
i sucks at maths (:
but I took a lot of time in E and got only 3-4 minutes for F :(
E and F were like no thinking involved(if you are familiar a bit with dp and dsu small to large respectively), just implementation.
Am I the only who think most of problems were standard?
In abc problems are usually standard.
How to solve problem F?, I tried with DSU but then ran into memory issues.
Every time someone sets a brain-dead problem with DSU, somewhere in the world a kitten dies.
How to solve B problem?
Angle of incidence(i)=angle of reflection(r)
Hence , tan(i)=tan(r)
Now , write down tan(i), tan(r), and solve for the answer
https://atcoder.jp/contests/abc183/submissions/18122849
binary search worked for me , by comparing the ratio of sides of both formed triangles , but I am sure theres also a O(1) solution for B .
The ratio of the x values is the same as the ration of the y-distances.
$$$x=sx+(gx-sx)*sy/(sy+gy)$$$
For those interested, I posted an unofficial English editorial at https://codeforces.me/blog/entry/84653
How to solve D ? I sorted the segments by left point and tried to solve using two pointer starting form right . It gave 5 test cases WA.
D is a very standard interval/event management problem.
I used the same idea but kept getting WA on hand_05.txt test. This is my submission: https://atcoder.jp/contests/abc183/submissions/18161545
Is there anything there in my implementation? I could not figure out why this particular test keeps failing.
try it in c++ xD
Any reason why Java does not work?
Wow! I failed the exact same test case for the exact same error. This is the one:
You never check freq [0] in your if statement. The constraints mention that the values of s and t can include time 0. My fix was to change i to start from 0 and do prefix sum only if i > 0.
Ahhh, I swear to God I thought see s > 0. LOL, well, thanks!!
I tried E with some precomputation.My time complexity is O(N^2). 5 pass.But it failed the test case 11.
Please don't post code here in this manner. Rather you can mention your atcoder submission link here.
Okk.
Please edit or delete it
please delete it
There is no option to delete the comment.Srry.
This is some ugly code polluting the comment section.
Use spoilers and block to make your comment look good.
How do you convert transitions in E from $$$O(N)$$$ to $$$O(1)$$$ in an easy way? What's the usual style guide to follow? It was an easy and fun problem. I wasn't able to implement the summing up of dp values of rows, cols and diagonals in an easy way that accommodates stopping at a wall (which is done in $$$O(N)$$$ making my solution cubic; would TLE).
partial sum
I figured you had to do that (and I tried it). But, how do I take care of the sum once I hit a wall?
Nevermind, I'm stupid. I made it more complicated that it should have been. Sorry for disturbing sare.
You should have 3 array. Let's call them
psum_row, psum_col, psum_dia
. And if there is a wall in cell (i, j) then just all ofpsum_row[i][j], psum_col[i][j], psum_dia[i][j]
will be equal to 0. codeHow to solve E? my code
Video editorial. It was my first time to record a video editorial, hope you guys enjoy it.
How to solve F?
I use segment tree merge to solve it.And it runs fast.But I think it is not a good solution.What is the simple solution?
Can you tell how to solve D when the P is not litre per minute but total litre required? (All constrains being same or even tighter if possible)
I thought it that way and tried sorting all points and then using a priority queue to give the new hot water to the interval with least end point among all active interval, not knowing the time complexity.
You could distribute available water (per minute) to people needing it, greedyly choosing the ones first where the time segment ends first. This way each person has at end of interval got enough water, or not.
that will require floating numbers, can we avoid it
There is no need to floating point numbers, because there is no need to devide the available water in fractions. Just add the available integer number to the people active at the current minute, starting with that perons whichs interval ends first.
yeah thats the method i write in original comment, isnt that, but what will be the complexity?
This is O(minutes) + the sorting of the people
Just use prefix sum concept. O(n) solution.
How exactly I dont understand, how using prefix sum
Have a look at my solution.
Brief: you have to add p from s to t-1. So you add p at s and remove p from t and then get prefix sum of the whole array. If any element of an array if >w then "No" else "Yes" Rest you can get from my solution.
Wasn't this the obvious solution? I'm surprised many have used events to solve it.