| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 5 | Um_nik | 141 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 133 |
| 8 | maroonrk | 133 |
| 10 | qwexd | 130 |
|
+3
It isn't brute force actually, the while loop runs for nlogn, it's the same pattern as n+n/2+n/3+..n/n, also the lower_bound call adds another factor of logn making it nlog^2n |
|
0
Ya got it, so you are removing the candidates which don't have prefix of length l same so they wont be checked ever again, and in the worst case if no candidate are removed then its the same as nlog^2n when all char are equal. Great! |
|
+5
Do you have any proof for the upper bound when using hash? I did with zfunc worst case O(N* (logN)^2) |
|
+3
Hopefully yes because out of top 250 many are from the same colleges mostly IITs, NITs, and BIT so you should qualify |
|
+3
|
|
+3
What is the number of slots for each site can anyone tell? For Amritapuri it's 250 but for rest no idea. |
|
0
Auto comment: topic has been updated by Gwynbleidd_ (previous revision, new revision, compare). |
|
+6
Us bhai us.. literally us momint hogya.. conragts |
|
+20
pretty cool ain't it? |
|
+22
conragts to Gwynbleidd_ for finally reaching CM ( ME ) |
|
0
What i did was just printed the g(x) value for start and end point for each f(x), i.e. 2^i, 2^(i+1)-1 and it turned out the difference between them is atmax 1. and since it is monotonic u can find the point where it changes using binary search. |
|
+12
f(x) ranges from 2 to 60 and for each f(x), g(x) is monotonic. Also for each f(x) if you check g(x) can have atmax 2 values. Precompute for all such ranges and answer it. tc: q*70 ig |
|
0
For easy version I checked for every pair of segments that occur together so when I saw m=10 I thought maybe we could use bitmask dp and it would pass but didn't had time to try it out. Thanks! |
|
0
If 2 index are same then doing operation between them does nothing and doing an operation that don't cancel either one of them affects the rest elements outside them also. Rest was proofbyAC. |
|
0
Always use 1 and try greedy |
|
0
Hint 1 if count1 != count0 then answer is -1 cause one operation increases both by one and in the final string both have to be equal Hint 2 Try to balance the leftmost and rightmost index each time using at max 300 operaions |
|
0
can E2 be done with bitmask dp? |
|
+12
mine just printed around 41 of them idk if my code crashed or the test cases had issue with the test case so can't say for sure. Also didn't get any error, the code compiled perfectly fine for me just didn't get all the outputs. |
|
0
They haven't released it yet for this year, although you can lookup the last years announcements. About 130-140 seats were there for Amritapuri last year ig. |
|
On
atcoder_official →
Japan Registry Services (JPRS) Programming Contest 2023 (AtCoder Beginner Contest 324) Announcement, 3 years ago
+1
The point is that the solution considers 0 as a perfect square |
|
On
atcoder_official →
Japan Registry Services (JPRS) Programming Contest 2023 (AtCoder Beginner Contest 324) Announcement, 3 years ago
+3
I don't know why would someone think of putting 0 in the test case |
|
+3
hopefully atleast +6 this time |
|
+4
No need to do it for each bit. If you want to make a whole subtree equal then you need to make all children of the root equal to root otherwise its not possible. There is no way we can change the root value to be equal to the value of the child without changing the child. |
|
+1
If you have the formulae to calculate dp for any parent from it's children then you can also use the same formulae to reroot the tree to the child from it's parent. Keep doing it recursively in dfs and calculate answer for every node |
|
+9
tree dp / rerooting |
|
+3
Why the skill difference between D and E so high everytime. btw how to approach E anyone? |
|
+4
just search sum of xor of all subarrays and you'll find it on gfg. Link |
|
+2
C seemed pretty easy at first but after getting 3 WA and getting AC finally I realized that I was right |
|
0
D was just a modified version of an existing problem with just a few changes needed while implementing it. |
|
0
Updated with links |
|
0
Auto comment: topic has been updated by Gwynbleidd_ (previous revision, new revision, compare). |
|
+11
Can't you just sort them or use a priority queue? |
|
+5
Yup understood the same and thought wouldn't it make this a trivial solution for each k it would be square of length 1 if it exists in array but then figured out later that it meant that the smallest rectangle that would cover all the points with same value |
|
0
Can we solve E with tries or is it some dp or something else that my small brain couldn't think of? |
|
+2
me spending 10 minutes trying to understand what problem C was trying to say |
|
+3
Anyone having any idea about 2023-24 prelims for amritapuri? The official site shows the registration has started and it would be held on 26ht november but apart from that i can't find any other discussion or announcement blogs. |
|
+4
Maybe that's why people don't like codechef anymore |
|
0
As CodeChef_admin said in the comment below debug wa feature doesn't work for that problem so your code could be failing in some other test cases. Link |
|
+3
Then this AC solution is wrong and the test cases are poorly written. Also your code might be failing on some other test case then. |
|
+3
My solution outputs the same and got accepted maybe there is a bug in your implementation submission |
|
-8
No rank and score updates, long queues, constructive problems in div2 and also didn't understood why my code works fine for Ant and passes all test cases but it just does. |
|
0
Firstly you are doing one operation outside the loop and then for each iteration in loop you are doing 2 operations and the loop runs for 2n+1 times resulting in 1+2*(2n+1) operations that is more than the required 2n+2 I/O operations needed |
|
+3
Whenever i encounter an interactive problem in the future this contest would remind me to read the I/O format completely before attempting it. Thnx |
|
-15
|
|
+24
This ruined my contest. Literally i got 4 runtime errors on pretest 2 for this reason. In the question it was mentioned if 2*n+1 moves are done then the game finishes. Also there were no pretests that had 2*n+1 moves to make it more clearer. |
|
+12
Hopefully I reach closer to cm |
|
0
idk bro. i didn't do it by manipulating the bits directly but by trying 2 options for each element. Either it gives first some power of 2 and then takes some power of 2 or the other way around and whichever worked without violating the conditions stored it in the map and then checked whether the counts are equal or not |
|
0
ok mb i didn;t see your rating |
|
-13
deserve the downvotes ngl |
|
0
This was my first approach which gave WA. So you are good |
|
0
Idk but i also got WA on pretest 6 due to silly mistake(Writing — instead of +). I also ignored all elements equal to the target final value because we can always use them as the middle man for some operation. |
|
-10
For each element you need to give some power of 2 to someone and also take some power of 2 from someone and for each element not equal to the average of the whole array this give take pair is unique. Also if the sum of all elements of the array is not divisible by it's size then answer doesn't exist. |
|
+1
Thought i had D1 in 5 min but after getting 2WA realized i was wrong. Really nice contest! |
|
0
ya insted of storing xor of all zeros i used xor of all values since you can get xor of zeros just by doing xor1 ^ xorall |
|
0
If you swap the values for a node it's children's values also have to be swapped |
|
0
I stored the xor of 0's in the range and xor of all 1's in the range and for lazy updates whenever i find a range that is inside the needed range just swap the values and set its children to do lazy updates whenever they are visited. And before accessing any range check if it has to be updated or not, if yes then update its value and set its children to do lazy update whenever they are visited. |
|
+1
For range updates you need to use lazy propagation, otherwise if you try to update all values in the range then cost for each update is O(n). If you are given q queries each of size n leading to O(n.q) so the TLE |
|
0
Ntg's wrong with it except the fact that my brain decided to stop working for few minutes |
|
0
Got it thnx. I first thought about 2 separate prefix xor array's one for ones and other for zeros complicating it that's why i aborted the idea and went with segment trees. |
|
0
I thought about using prefix sums but it would have taken some time to figure out the correct way for it so instead I used segment trees with lazy propagation which was pretty obvious. Still messed up the code and got 2 WA's |
|
+11
Was it just me who wasted 5 min on problem A because of this: Spoiler
|
|
-11
Segment Tree |
|
0
Kind of but the constraints are also important. |
|
0
|
|
On
atcoder_official →
THIRD PROGRAMMING CONTEST 2023 ALGO(AtCoder Beginner Contest 318) Announcement, 3 years ago
+3
Now my username make sense. Thanks |
|
On
atcoder_official →
THIRD PROGRAMMING CONTEST 2023 ALGO(AtCoder Beginner Contest 318) Announcement, 3 years ago
0
I also thought the same but couldn't figure it out. Code |
|
On
atcoder_official →
THIRD PROGRAMMING CONTEST 2023 ALGO(AtCoder Beginner Contest 318) Announcement, 3 years ago
0
I think my E should have worked but it gave WA. Can anyone tell me where I got it wrong. Approach For each distinct element x make an array of it's indices where it occurs. Like if |
|
0
List of numbers inserted in order: The first 4 elements are not sorted so the |
|
0
If you only multiply by positive number then the answer would be number of elements |
|
0
I went about it like this: If n = 2^k then we can at every step subtract it by n/2 to finally reach 1 using every number exactly once. Eg: 8->4->2->1 Now suppose the highest set bit in the binary representation of n is k. Then we know that we can reach 1 from 2^k. Now how to reach 2^k from n? At each step we turn off the LSB of n from it till it reaches 2^k since the number formed by the LSB always divides the number and using this operation we use each number only once. |
|
0
Ya ig i did oversimplify it. Thanks tho. |
|
0
Yes my approach was also similar. For every a[i] I found the ranges it covers consisting of elements greater than or equal it then used a prefix sum array to calculate the total cost. Could you tell what was wrong in my approach? |
|
+10
In the constraints it is given k<n every time all odds and even wont get swapped |
|
0
Suppose if you sort the whole string you know which characters are at odd and even indices in the final sorted string. Then you can use the second operation to change the parity of any character that is not in it's correct parity list and finally sort it using first operation. |
|
0
What is the intended solution for F? My approach was for a query [L,R] first check if L==R if yes then only one operation is needed otherwise we need to bring all element in range [L+1,R] to L and then use one operation to reduce all to 0 but it gave WA on pretest 5. Submission: 220592550 |
|
0
Because of the first kind of operation you can sort all the odd indices and even indices separately. Now if the other kind of operation allows to swap characters at the end of an even window then you can use it to send any odd index element to even index. This allows us to sort the whole array. |
|
0
Lol i thought it was question F nvm mb |
|
0
First we could break it down to 2 different cases. Since the relative position of Bob and Alice doesn't matter then for query i let u=min(U[i], V[i]) and u=max(U[i],V[i]): Case 1: if a[u] < a[v], then whoever was at position u can go to position v since both condition are satisfied(we initially set u to the min and v the max) and it would be the answer. Case 2: if a[u] >= a[v], then we need to find the first index j > v such that a[j] > a[u]. For this we could use a Segment Tree. We build a range max query segment tree where each node stores the max for the range. Then we binary search on the segment tree to find the range. Suppose the max of the range [v+1, n] is <= a[u] then the answer is -1, otherwise we check the left subsegment and the right subsegment. If the max of left subsegment > a[u] then we move to the left subsegment(since we want the first index in the range) otherwise we move to the right subsegment. Tc: O(logn) |
|
+1
Not a very efficient approach but i think it should work: Think of all groups to be max heaps containing the elements. Also remember each elements index in its respective heap or group after each operation. Inserting element in group would simply be heap push operation O(logn), Changing score of element would be using the elements index in its heap and doing decreaseKey() operation in the respective heap 0(logn), changing all elements in a group would be changing each value in heap to O(group size) and printing max score of a group would be heap.top() O(1). |
|
0
Deleted |
| Name |
|---|


