We will hold Tokio Marine & Nichido Fire Insurance Programming Contest 2022(AtCoder Beginner Contest 256).
- Contest URL: https://atcoder.jp/contests/abc256
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20220618T2100&p1=248
- Duration: 100 minutes
- Number of Tasks: 8
- Writer: Nyaan, kyopro_friends, m_99, leaf1415
- Tester: Kodaman, PCTprobability
- Rated range: ~ 1999
The point values will be 100-200-300-400-500-500-600-600. We are looking forward to your participation!
A-F are pretty cool, how to solve G?
How do you know the problems of the contest in advance? lol
Experience XD
For E, I already used union-find and summing up the minimum cost for each component. Still WA.
You should only do that for cycles, similar problem
You need to use
mst(maximum spanning tree in this question) , think every relation like an edge , we dont want any cycles , and we want to delete small relations to break cycles , when we delete a edge , you should add its value(weight) to the answer
It can also be done using priority queue.Here is my submission
Quite cool of the author allowing sqrt-decomp to pass F
In problem E i stored the graph as undirected one and broke the cycles into 2 cases ,the vertices which belong purely to a cycle and the others which have a cycle and a chain (for these i rand dfs from vertices whose adjoint size was 1 until i found a vertice with adjoint size 3) . But it gave WA. Could somebody point out why the approach is wrong.
code
i realised my mistake (there can be more than 1 chain attached to a cycle).Pls ignore the above message
On the way from reading C to understanding C I somewhere lost meaning of h[],w[], to be maximum posible value of row/col, instead of exact value. Then its hard to solve.
normalize discussing ABCD's of abc contest (_/_)
I use segment tree + lazy propagation for arithmetic progression for problem F. But I got wrong answer, can someone point out where I might be making the mistake?
My submission
I think maybe your multiplication has a risk of integer-overflow.
Hmm... if I do modulation each and every time, wouldn't it be the case? Oh and also I do something like
#define int long long
oh sorry, I didn't notice your
#define int long long
. But I still guess that it has something to do with integer-overflow. Maybe your line-126int chg = v - a[x];
has a negativechg
and this may lead to something that is not expected.Consider this simple testcase.
Thank you for providing such a cool contest.
Problem D involves a wonderful trick. By implementing a[L]++ and a[R]--, and then calculating the prefix sum, we could find out all the intervals that have been covered.
Problem E is about graph with directed edges, and one should be familiar with topological sorting and also how to find out the cycle.
Problem F needs some mathematics to deduce the expression of Dx, and one should also be very careful of integer-overflow.
As for Problem G, at first, I was scared by the super huge N. After I found out the state transition of dp, then I realized that it could be reduced to logN by using Fast-Exponentiation-Algorithm (matrix version). But my definition of dp state is somehow a little bit complicated and didn't finish codes before contest ends.
The easiest and worst sol for problem C :)
It got Accept
The first 6 IFs are fairly useless since allways true, so it would be easier to remove them.