We will hold AtCoder Beginner Contest 473.
- Contest URL: https://atcoder.jp/contests/abc473
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20260829T2100&p1=248
- Duration: 100 minutes
- Writer: MMNMM, physics0523, vwxyz0, sheyasutaka
- Tester: sheyasutaka, kyopro_friends
- Rated range: ~ 1999
- The point values: 100-200-300-400-450-525-600
We are looking forward to your participation!









Hoping to A,B,C,D at least.... :)
I hope I could solve Task A-D.
Me too.
me too
Me too
me to
Hope it's not rubbish round like abc472.
Another day for ABC
Me too...
pls let me solve F?
Maybe I can't solve B.
I will never be able to solve A.
You must be saying some P words,for you actually solved tasks ABCE last night.orz
Big shot, your ranking is higher than mine. I'm a no-good
but you solved A faster than me.
Hoping I can solve E
Hope I can solve A,B,C,D.
Ans good luck to everyone!
D is a little bit difficult,I wonder what is the examiner thinking when he created this problem
yup it requires a concept which i have forgotton after leaving cp , feeling bad
wtf, why did brute force pass for D? Still can't wrap my head around it
backtracking with pruning?
idk if there's any pruning. Care to take a look? This is my code:
https://codeforces.me/blog/entry/156291?#comment-1388969
me too
Hope I can solve E and F
wth with D problem..
The hell is the C problem i dont understand the language
nvm im a idiot
Was able to solve from A to E.
D was harder than E, i solved E in 0:25 minutes but couldnt solve D
bruhhh i should have focused on problem E instead of D... couldn't finish it :|
Wuwuu.... (crying loudly)
My D TLEd....
Why is my program so slow QwQ...
If the evaluation machine is a supercomputer, it should be able to pass
My Code:
i thought D is just one of the basic backtracking problems?
Basic backtracking problem? Can you tell me some resources where you practiced these problems? I seriously many-a-times get stuck at these problems thinking for an optimised solution when we only need to do brute force. This time also same thing happened.
n = 10 and you'll probably know this is a backtracking problem. if your naive solution got a tle, you can think of how to do a low-level optimisation like somehow pruning early, like this problem, you dont backtracking the last element, and if the sum == k for print the rest of the array with 0. Most of the time you'll be find. That the constaint is small means one of those 2 things: - The problem is somehow easy and just need us to backtracking and pruning. - The problem is a np hard and need some heuristic or complex solution
yeah I did see n=10 but I thought the depth of recursion will result in tle somehow....didn't practice much of these problems so just took leap of logic there...sigh...anyway thanks for responding.
A mysterious backtracking problem with unclear meaning.
try to deal
pos == ninbuild(...)?you can try this ~~~~~ void backtrack(int pos, int sum, vector &cur) { if (sum == k) { for(int i = 1; i <= n; i++) { cout << (i < pos ? cur[i] : 0) << ' '; } return; } if (pos == n) { int rem = k — sum; if (rem % n == 0) { cur[n] = rem / n; for(int i = 1; i <= n; i++) { cout << cur[i] << ' '; } } return; }
int mx = (k - sum) / pos; for(int val = 0; val <= mx; val++) { cur[pos] = val; backtrack(pos + 1, sum + pos * val, cur); }} ~~~~~ pruning early like this and you'll be fine
hey, can you post your code in better format or give your submission link? i struggle a lot on backtracking.
https://atcoder.jp/contests/abc473/submissions/78792184 here you go
I did the same but why am I getting the TLE
~~~~~~~~~~~~~~~~ public class Main { public static List ans; public static int cnt = 0; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long k = sc.nextLong(); ans = new ArrayList<>(); rec(1,n,k); }
} ~~~~~~~~~~~~~~~~~~~
it's not the same you know, in your code, you have a unnecessary state of computing the last element which +1 height to your dfs tree, and also you can pruning right after k == 0 (using the rest of the element as 0); (also limiting your choice when calculate for element i improve the time a lot); you can see those pruning in my code
A-F is quite easy, I think F is only *1800,only segment tree is used. But G probably needs NTT, it's a big difficulty gap.
upset,D is so difficult!!!
I can tell that F is about a Fenwick tree,but I forgot the template.what a pity!
I AK ABC473.
A<B<C<E<F<G<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<D
D is not a problem!!!
E,F,G are BORING!!!
how you are able to solve G(a probability problem with convultion and dp dnc) and say a simple backtracking problem like D is harder than it?
I agree with you,G is impossible for me to get any score.
I took 3 penalty hits on D, and G didn’t touch me.
Oh,I accepted D in one submission,but G made me think 30min and no progress.
Problem G is just a braindead DP + polynomial problem, and Problem D is pointless search nonsense.
I cannot figured out the combinatorics formula for the final problem. Guess my math skill isnt good enough. Can anyone show me the idea and walkthrough about how you figured out and solved it?
Let f(n, k) be the answer. If you choose a card, it can be either the next you need or a wrong card.
If it's the next you need (probability 1/n) you have 1/n * f(n-1, k-1) probability, because you need to play k-1 times and you have n-1 remaining cards that you don't know.
If it's not the next card you need (probability (n-1)/n) You just discovered a card you will need in a future step, but this will also cost 1 more move to get that card, and there is still n-1 cards you don't know. So you spent 2 steps to reduce your problem to a n-1 problem. then probability will be (n-1)/n * f(n-1, k-2).
After this I figure it out it was about Stirling numbers of the first kind because of the recurrence (ignoring the division by n) f(n,k) = f(n-1, k-1) + (n-1) * f(n-1, k-2) (The original recurrence is a little different, but you can find it changing some terms) and in the end I needed to divide the answer by n! (because in each step you divide by n and go to n-1).
i dont know how to optimize my idea but i have some small solution about this problem. So firstly, i wen through the way to minimize the expected value for each permutation. The strategy is actually very simple, we go from left to right, flip the unrevealed cards, if the card is not what we looking for, we remember it, continue flipping. When x equal to a number that we have seen, turn back and eat it immediately. So the answer for a permutation is just simple, it's N + (number of time that we have to flips a card we dont eat); so we have dp[i][j] is the probability to have j steps to flip a card that we dont eat after considering the first i cards. it has 2 case for us to switch the state of the dp. the first is i is equal to x, which is the card we looking for, then the probability is 1 / i; if not the probability is i — 1 / i; so our dp formular should look like this: dp[i][j] = (1 / i) * (dp[i — 1][j]) + (i — 1 / j — 1) * dp[i — 1][j — 1]; I dont know how to optimize this further, maybe by using dnc and fft
Just use generating functions with an NTT and you’re done.
Here is my solution for E. No idea what went wrong Link
No idea what case I am actually missing on
I passed G... but at 21:40:22. :(
Easy round
I don't know why he likes eating cards:(
I think that D is more difficult than other quetions!!! Since I've had so many TLEs... My Code:
It's hard to come up with the idea of using DP to optimize pruning.
I don't think dp is needed here...my solution passed without any dp whatsoever...or did I use dp without knowing?
I was forced to use DP pruning because the server was extremely slow during the contest.
oh so that's why dp was necessary...i submitted after contest so maybe that's why my brute solution passed
Congrats! Probably because your code is clean and has a small constant.
I would also like to add my solution that I submitted after contest was over T_T ... During the contest I was so sure it wouldn't pass.
D is VERY terrible.The others are not tooooooooooo bad.
In the editorial for problem G — Wipeout, en_translator cleverly utilizes
#include<atcoder/all>to implement the NTT function. I find this quite impressive. Would someone kindly explain how to correctly use the atcoder namespace?I solved D with DFS:)
But I spent too much time on D, so my pref is low, MY RANTING IS ABOUT MY SCORE GOING STRAIGHT INTO THE TOILET!!!
My code of D get AC*37 and TLE*1,why???Doesn't AtCoder Judge run fast?
Why SO many NTT?
I ask this problem in LAST LAST week too.
what is exactly NTT? is it an abbreviation?
Ever heard of Google or Bing?
Why SO many NTT?
In my opinion, A = B = C < E < F << D << G. What's so terrible about problem D is that you'd never figure out from pure thinking during the contest that a slightly optimized brute force could pass, and it takes way too much courage to actually write that kind of brute force in an ABC.
D is harder than G..........
If you know how to do divide-and-conquer NTT.
Why does the editorial for problem G use the atcoder namespace? I fucking wrote NTT by hand!I hate NTT.
BORING CONTEST! Why do u let me put so much time(nearly half an hour) on making my code run faster and faster on problem D? Why do u put NTT for problem G? Why is problem F almost a template for segment tree?
G is almost always NTT these days.
who can teach me how to solve G, please!!!
This is my first time solving problem F.
I got a TLE on D at least. :(
First F!!!
Regret not having watched E
AtCoder is shamelessly promoting their ACL.The just put an NTT in problem G.
This is my first pb , try to solve atleast 3 pb
this will be my first contest , try to solve atleast 3