AtCoder Beginner Contest 242 Announcement - Codeforces
source link: http://codeforces.com/blog/entry/100601
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
We will hold AtCoder Beginner Contest 242.
We are looking forward to your participation!
29 hours ago, # |
Cpp20 when D:
28 hours ago, # |
What happened to the judge? It's so slow.
28 hours ago, # |
Long queue!
27 hours ago, # |
Problem C is not beginner friendly :(
for Problem C:
10,11,12
21,22,23
32,33,34
43,44,45
54,55,56
65,66,67
76,77,78
87,88,89
98,99
for n=2, shouldn't the answer be 26 instead of 25(given in question)?
26 hours ago, # |
How to solve D?
-
For t <= 62, you can imagine finding value on a binary tree. It the ith bit of k is 0, go left, else go right; For t > 62, since we have a tons of leading zeros in k (0000...), we can do binary lifting. Submission
-
What I did:
First find out, which is the letter from the original string, that creates the block in which the char from the query will lie. This is
realpos = pos / (1ull << it)
. Then determine the position inside this block, where the query will be. This isinnerpos = pos % (1ull << it)
. (Special case for more than 63 iterations has to be implemented.)Now we know the letter from the original string. We take that as a base BB. Instead of "A->BC, B->CA, C->AB." I will use "A->AB, B->BC, C->CA." now. To account for this change we add the number of iterations to BB.
Now we need to consider the
innerpos
. Which letter will be at this position? This hapens to be the count of set bits ininnerpos
in binary. So we just need to add__builtin_popcountll(innerpos)
to BB.Then BB is the answer. https://atcoder.jp/contests/abc242/submissions/29884835
26 hours ago, # |
Today I used Mo's algorithm for the first time.
-
Same dude, I was able to solve GG because of that, but not FF.
-
I noticed that dush1729 solved it quite quickly, so decided to do G before F (which turned out to be not that difficult as well, just some combinatorics and inclusion-exclusion).
-
-
Yes, that was also exactly my experience! Didn't want E, couldn't F, saw G. Never did Mo before but it so much looked like Mo, so I had to do it.
-
I forgot to change the block size in my first submission in problem G but in fact, block size of 32 ran faster than 750. I don't know the reason why the solution was accepted...
26 hours ago, # |
How to solve H?
GG-Range Pairing Query There is no editorial yet
:/:/
How to solve GG? I wanted to come up with a Segment Tree solution but I failed when I wanted to find all the distinct numbers in range l...rl...r.
PS : Did anyone solved it with Segment Tree? Or it has different algorithm to solve it?
26 hours ago, # |
third one I did by using dp very cool one see once
Your code here...
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st;
st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken())-1;
long mod = 998244353L;
long[][] dp = new long[n][9];
dp[0][0] = dp[0][8] = 2;
dp[0][1] = 3;
dp[0][2] = 3;
dp[0][3] = 3;
dp[0][4] = 3;
dp[0][5] = 3;
dp[0][6] = 3;
dp[0][7] = 3;
for(int i = 1;i<n;i++){
for(int j = 0;j<9;j++){
if(j == 0){
dp[i][j] = (dp[i-1][j]%mod+dp[i-1][j+1]%mod)%mod;
}
else if(j == 8){
dp[i][j] = (dp[i-1][j]%mod+dp[i-1][j-1]%mod)%mod;
}
else{
dp[i][j] = (dp[i-1][j]%mod+dp[i-1][j-1]%mod+dp[i-1][j+1]%mod)%mod;
}
}
}
long ans = 0L;
for(int i = 0;i<9;i++){
ans = (ans+dp[n-1][i])%mod;
}
bw.write(ans+"\n");
bw.flush();
}
26 hours ago, # |
For problem E I use digit DP on string. The states are dp[length][prefix_same][suffix_bigger]. Submission
-
You can also do dp[index]dp[index], where dp[i]dp[i] denotes the number of lexicographically smaller strings for index i,1≤i≤(n+1)2i,1≤i≤(n+1)2. Finally, define tt as follow:
string t = s; for(int i=1; i<=(n+1)/2; i++) t[n-i] = s[i-1];
If the string tt is lexicographically smaller than ss, or with c++ you can just check if t<=st<=s, add 1 to the answer. submission
26 hours ago, # |
Does anyone think that F was way harder than G?? I almost took half of my time solving F, but solved G in a few minutes as I knew Mo's algorithm(which was very lucky). Looking at the number of people who solved F and G I guess most people would have felt similarly. Or, is there a simpler solution to F?
-
My solution involves two steps, first calculating dp[r][c][k], which represents the number of possible covering of r x c with k rooks of a same color without leaving a row nor column empty, and then the second step was just simply iterating through number of rows and columns for black rooks and white rooks, and adding the value dp[rb][cb][b]×dp[rw][cw][w]×(nrb)×(n−rbrw)×(mcb)×(m−cbcw)dp[rb][cb][b]×dp[rw][cw][w]×(nrb)×(n−rbrw)×(mcb)×(m−cbcw) for each rw,rb,cw,cbrw,rb,cw,cb.
-
I also had a similar solution, but the process of calculating dp[r][c][k] was very complex. I guess it was what made the problem so hard
-
Ah, there was a fairly simple transition between dp states. All you had to do for calculating dp[r][c][k] is to first add (r×ck)(r×ck) and then ∀1≤i≤r,1≤j≤c∀1≤i≤r,1≤j≤c (excluding (i, j) = (r, c)) subtract dp[i][j][k]×(ri)×(cj)dp[i][j][k]×(ri)×(cj) from dp[r][c][k]. Hope this makes sense
-
-
26 hours ago, # |
It didn't count for the contest. Makes me so sad, that was the most clutch. It was a last second debugging and panic-submission. [May I get an F?]
But also it was way to complicatly implemented from my side. I though at first this has to be digit DP with some kind of state for the second half of the palindrome. But it was more like the simplest form of Digit DP (means, interpret the first half of the string as a number) plus checking whether the palindrome created by using the first half of the string is valid. If I had just thought about E more, then I guess I wouldn't have had this time problem.
26 hours ago, # |
It seems official solution of Ex is not min-max inclusion and exclusion?
hello, I was getting a runtime error when I was running code on vs code for n>=10^5, submssion I didn't submit the code because of this and after that contest when I submitted It got accepted but still got a runtime error for n>=10^5 on vs code. can someone explain why?
25 hours ago, # |
why can't I see rankings by country?
-
Since the last heuristic contest they've experienced server overload (or something like that) so sometimes they disabled ranking page. There also has been postponed contest around last week or two. I assume this functionality is temporarily disabled to cut performance cost, tho I'm not sure.
25 hours ago, # |
Really nice problems. For me the problems difficulty were F > D > E > G. Did anyone else felt the same way?
Problem E from this round was almost the same as Problem A from Kick Start Round C, 2021
Was this intentional?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK