Блог пользователя Mo2men

Автор Mo2men, история, 5 лет назад, По-английски

Hello, Codeforces!

I'm glad to invite you to Codeforces Round #737 (Div. 2) , which will be held on Monday, August 9, 2021 at 16:35 UTC+2.

This round rated for the participants with rating lower than 2100.

You will be given 5 problems and 2 hours to solve them.all problems were prepared by me and AhmedEzzatG.

One of the problems will be interactive. So, it is recommended to read the guide on interactive problems before the round.

I would like to thank -

  1. Aleks5d, for awesome coordination of our round and suggested one of the problems.

  2. Ahmed-Yasser for help us to prepare the problems. compiler_101 ,AntiBsayer ,TripleM5da , and Omar_Elawady for discussing and testing the problems.

  3. MikeMirzayanov, for the amazing Codeforces and Polygon platforms.

  4. Testers physics0523 , BlueDiamond , Tlatoani ,mahmoudbadawy , Andreasyan , IsaacMoris , Error_404 , Basilhijaz , gotexans , wxhtzdy , Blobo2. , elizkaveta , zetamoo , Muhammed_Atef_Hassan , tdpencil , robert9524 , mosemAlanfgar , NotHosam , Bakry , Abdo_Naser , kalki411 , Hemose , Uzumaki_Narutoo , and our VIP tester Monogon.

The statements are short and I have tried to make the pretests strong. I encourage you to read all the problems.

This is our first official round on Codeforces. We are sincerely looking forward to your participation. We hope everyone will enjoy it.

Good luck and see you in the standings!

UPD1: I want to thank Aleks5d for translating statements into Russian and mouse_wireless author of one of tasks.

UPD2: Scoring distribution: 500 — 1000 — 1750 — 2500 — 3000

UPD3: Editorial

UPD4:

Winners

Congratulations to all our winners in the round!

Div.1 + Div.2:

  1. tourist

  2. jiangly

  3. m_99

  4. BigBag

  5. Geothermal

Div2:

  1. FengzhuJian

  2. juruo_cjl

  3. RGB_ICPC4

  4. End.

  5. Hanabi2333

  • Проголосовать: нравится
  • +292
  • Проголосовать: не нравится

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +41 Проголосовать: не нравится

Your profile picture is really good and meaningful.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +125 Проголосовать: не нравится

Monogon was the VIP tester of 2 consecutive rounds!

Orz!

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +15 Проголосовать: не нравится

As a trainee for the author I am so excited and I am sure that the statements are short XD

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

keep going from ur trainee.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

As a trainee for the author I am so excited and I am sure that the contest will be amazing as the author is amazing XD

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Amazing!! It will be such a great contest!

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I'm excited! We are in a drought of contests, and I'm itching to compete more.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +27 Проголосовать: не нравится

As a tester, problems are great for the participants who love the short statements and like to gain high ratings!

Good luck to everyone :)

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Finally a SA3EDY Round #1، I hope it will not be the last one. keep going our heroes♡♡ ♡‿♡.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

Egypt Foooooo2 :"D

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +64 Проголосовать: не нравится

As a very cool tester, I would like to say that the problems are nice and the pretests are very strong. I think you'll enjoy doing this round.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +113 Проголосовать: не нравится

with the power vested upon me as a tester, I hereby declare thy contest interesting.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +195 Проголосовать: не нравится

Though I'm not a VIP tester, I tried hard testing as much as I can.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +32 Проголосовать: не нравится

As a contest tester for the first time :), the contest is great and joyful.

I hope you will enjoy it ;)

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Someone explain me why the time of this post is showing like 2 days ago ,although it is just posted like 1 hr before i guess

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

It's going to be a great contest :)

»
5 лет назад, скрыть # |
Rev. 4  
Проголосовать: нравится +12 Проголосовать: не нравится

As a trainee of the author i am sure that the problems are epic, Good luck

Give me and my coach contribution :)

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +67 Проголосовать: не нравится

I decided to write the ultimate "as a tester comment" since this is the first and hopefully not the last time to be a tester of an official round (except of course if you count #716 #717).

1) as a tester add me to your friend list

2) as a non-VIP tester I hope I can be a VIP tester one day

3) as a tester I assure you that you should give my friend mo2men contribution

4) as a tester... (recursion ;) )

5) as a tester I advise you to read all the problems

6) as a tester I think you should prepare everything you'd need throughout the round because you won't be able to move or blink during the round

7) as a tester this round is pure awesomeness (kung fu panda 2008 reference)

8) as a tester of this round I would like to test upcoming rounds... maybe the next is yours? who knows

9) as I am 50% of the specialist testers population in this round help me by upvoting this comment

10) as a tester I recommend everyone to eat jilaty (ice cream in Arabic)

Note: the profile picture was taken by my friend and the author Mo2men in the Arab collegiate programming contest 2020 (ACPC)

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

cant be proud more my friends keep going [user:IsaacMoris][user:Uzumaki_Narutoo][user:Blobo2_Blobo2] i sure the contest will be so beautiful ♥♥

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +99 Проголосовать: не нравится

As a tester give me contributions.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

tdpencil has hacked few of my solutions in the past, so for me he is orZ. yeah!! this orZ has curves.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +25 Проголосовать: не нравится

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

تحيا مصر ❤️

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +26 Проголосовать: не нравится

Wow you really host a div-2 contest when you are just specialist. ORZ

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I just hope I can become a "Pupil" through this competition.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Hope to become "Pupil" through this contest.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Good luck to everyone!

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

As you get ready for the contest, I wish you all the best of luck

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Most valuable advice ❤️❤️

Cap-ture

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

feels like ages since the last round it's like all problem setters are on a vacation or something

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

We are so proud of you all , keep going :")

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Mo2men (previous revision, new revision, compare).

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I will reach pupil in this contest.

Thank You

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I am so excited to participate in this round, hope everyone will gain rating

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

From the score distribution, it looks like it's going to be speedforces for A, B, C.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

Auto comment: topic has been updated by Mo2men (previous revision, new revision, compare).

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -43 Проголосовать: не нравится

whenever specialist expert makes a contest they always make it hard. If u are actively giving contests u know what I mean. They think it's cooler to make a harder contest. These pathetic nerds cant solve the all question themselves.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Short problem statements, thats what we wanted

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I always used to think that to increase rating one have to solve more and more problems. Mo2men has solved more than 2000 problems then why his rating is not increasing ( ・᷄ ︵・᷅ )

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -59 Проголосовать: не нравится

i hope i can get top 10 in this contest

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Oh interactive, is this binary search ? :V

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Looks like today their ll be more of a number theory problems.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -11 Проголосовать: не нравится

As a participant I wish to gain some precious contribution through this comment.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -20 Проголосовать: не нравится

will be unbalanced contest , I can bet

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

hope that a and b will not be interactive

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +45 Проголосовать: не нравится

Last few days I faced a lot in my life, Can't reveal what exactly happent. But you can assume that the sadness is as same as when you lose your father or mother or see them cry.Couldn't give last 3 contests with proper emotional and mental strength.But skipping a contest has never been an option for me.It's the only thing I have in my life to live for.I will try my best today.Good luck to everyone too

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -16 Проголосовать: не нравится

Is it just me? getting a TLE on tc2 for problem A

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

Remind me when I'm trying to take part in another weird round and get negative delta

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Formally, let your answer be a, and the jury's answer be b. Your answer is accepted if and only if |a−b|max(1,|b|)≤10−6. How to achieve this in Java ??

»
5 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится +27 Проголосовать: не нравится

Why the gap between C and D was a lot ?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

First experience of being able to do B but not A XD.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +64 Проголосовать: не нравится

giving combinatorics without some relatively big testcase — unethical:/

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -126 Проголосовать: не нравится
ll n;
cin >> n;
ll k;
cin >> k;
vector<ll>arr(n, 0);
for (ll i = 0; i < n; i++) {
    cin >> arr[i];
}
ll sz = 1;
for (ll i = 1; i < n; i++) {
    if (arr[i - 1] > arr[i]) {
        sz++;
    }
}
if (sz <= k) {
    cout << "YES\n";
}
else cout << "NO\n";

why I am getting wa for this..its the correct soln

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

I just erased my whiteboard 5th time full of test-cases for C and yet I am unable to decipher. I am almost sure it's gonna be a one-liner but I just can't figure it out :(

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I think the gap between the problems is too big :(

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +45 Проголосовать: не нравится

plz answer me a question whether you like the weak samples just because you think they're cool???

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +27 Проголосовать: не нравится

How the hell are 2500 people able to solve C

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I'm also wondering this too... So overall I'm too weak...

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +4 Проголосовать: не нравится

    Telegram I guess

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    My might fail in sys test, I checked the submissions of the people in my room and all of them have similar code but completely different logic than mine....Hope the pretests are strong

  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    I think about this issue like this :

    Consider sequentially from the high binary bits to the low binary bits.

    The i-th binary bit can be "decided" or "undecided".

    Decided means that the i-th binary digit a1 & ... an is already greater than a1 xor ... an, and no subsequent comparison is required at this time.

    Undecided means that the value of a1 & ... an and a1 xor ... an can be compared after the i-th binary digit.

    Undecided includes two situations : - n numbers are all 1 in the i-th binary digit and n is an odd number. - At least one of the n numbers in the i-th binary digit is 0 and there is an even number of 0s.

    Undecided means that all n numbers on the i-th binary bit are all 1 and n is an even number.

    The final answer is composed like this :

    • Undecided Decided Random
    • Undecided

    my code like this

    # include <bits/stdc++.h>
    # define int long long
    using namespace std;
    const int mo=1e9+7;
    int pow(int x,int n){
    	int ans=1;
    	while (n) {
    		if (n&1) ans=ans*x%mo;
    		x=x*x%mo;
    		n>>=1;
    	}
    	return ans;
    }
    signed main() {
    	int t; scanf("%lld",&t);
    	while (t--) {
    		int n,k; scanf("%lld%lld",&n,&k);
    		int res=pow(2ll,n-1);
    		if (n&1) res=res+1; else res=res-1;
    		int ans=pow(res,k);
    		if (!(n&1)) {
    			for (int i=1;i<=k;i++) {
    				ans=(ans+pow(res,i-1)*pow(pow(2ll,n),k-i)%mo)%mo;
    			}
    		}
    		printf("%lld\n",ans);	
    	}
    	return 0;
     } 
    
»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

shitty problems, bad balance and there are only 5 problems AT ALL

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

How to solve C?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Am I the only one here who had 2 penalties because of ignoring the fact that $$$-10^9 \le A_i \le 10^9$$$

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Weak sample for C :(

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

In div2 B i was rearranging the elements inside subarray for half an hour.

Sad noises.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I liked B it wasn't clear why the simple solution is not working but C is so hard still a good problem though I will try to solve it later

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is there another way to solve problem D instead of using a dynamic segmentree, curious -.-.

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +1 Проголосовать: не нравится

UPD: my bug was that I had to declare the Segment Tree Array with 8n elements

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +7 Проголосовать: не нравится

Contrary to popular belief, I liked problem C. A good question based on bit contribution and combinatorics.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

So i had this idea and observation for problem C:

For every number >= 1 times that it occures must be even. For example: 02211, 02222, 22110 etc. Total number of possibilities that pair of numbers can occur is n*(n-1)/2. There can be n/2 pairs of numbers in array, so total number of posibilities for 1 number is n*(n-1)/2 * n/2. Multiply this by amount of numbers: (2^k) — 1 * (n*(n-1)/2 * n/2). There also can be n same numbers that make problem condition true. So i also add 2^k to answer.

Can someone told me if that make any sense :D? Thought that would work but it didn't :/. Maybe it was only right for small numbers dunno

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Interesting problems. Is D a segment-tree problem? I think I could solve it if only I could implement a generic segment tree.

and btw. why a * b % c == (a * b) % c and a + b % c != (a + b) % c :<

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

How to solve problem D . I think it is similar to longest increasing subsequence problem in a way $$$a[j] \gt a[i]$$$ if $$$j \gt i$$$ and $$$ j^{th}$$$ row and $$$i^{th}$$$ row have some common intersection . I tried to use segment tree but could'nt implement in time

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Very clever to do tests with k = 1 and k = 0 on a combinatoric problem! Good job!!! Don't do any other contests please.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Why in problem A a hack with: t = 1,n = 10^5 and all a[i] = 10^9 gives invalid input?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +53 Проголосовать: не нравится

I spend about 1 hour on D......the solution is easy but it's hard to code :(

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve D any hints? do we construct some kind of graph?

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    use dp

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    Segment tree with DP is what I did. First compress all intervals, so that we can fit a normal segment tree in. Let $$$dp_i$$$ be the minimum number of rows we have to remove to make rows $$$1~i$$$ good, and keeping the i_th row. Then the dp recurrence is pretty simple: $$$dp_i = min(dp_j)+i-j-1$$$, where (j<i). We can rearrange the formula into $$$dp_i-i=dp_j-j-1$$$ then we can keep the value $$$f_i = dp_i -i$$$ in the segment tree. For the segment tree, we update the ranges of ones of that specific row with $$$f_i$$$ and for the queries to check the previous rows for the dp recurrence, we also query only the ranges where ones are located in the i_th row.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

I think the examples of the problems are so easy that it makes me be not able to find the bugs.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +46 Проголосовать: не нравится

I just loved $$$E$$$. Nice puzzle. Here's a small hint for those interested:

Hint
  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +19 Проголосовать: не нравится

    Okay, as the editorial solution is entirely different, I will describe my solution here (which I liked better).

    Solution

    Code: 125400662

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится
Solution for D
»
5 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

My solution on E seemed to read a direction other than the ones described in pretest 3. It's likely I got a bug somewhere, but did anyone notice any similar weird behavior, because I can't seem figure it out?

Edit: Found a bug and got AC, still not sure what my program managed to read after producing a wrong move.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

How to solve C?

  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится
    Spoiler
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

Your example is so stronger that every wrong code can pass!

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

What is the problem with MLE pretest 4 in Problem D? Was I the only one to struggle with this?

I used a lazy segment tree to build a graph then found the longest path in an acyclic graph. You only need to add an edge to the nearest row that intersects with your current interval. Is that approach wrong or what?

Edit: NVM, FeelsBadMan

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -11 Проголосовать: не нравится

Got TLE on C because of 32-bit python.

Very annoying.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

why you bully me , codeforce ?

»
5 лет назад, скрыть # |
Rev. 4  
Проголосовать: нравится +169 Проголосовать: не нравится

What the fuck? I randomly submitted this pattern in E and it passed pretests.

(Edit : It passed system test)

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Nice round guys, I enjoyed the problems :D

AhmedEzzatG Mo2men

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve C? It looked like a DP-Tabulation type of problem, but all I could figure out is that

$$$dp[n][k]=(2^{n-1}+1)^k$$$ when $$$n$$$ is $$$odd$$$

  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится +4 Проголосовать: не нравится

    Let $$$p = 2^{n-1}$$$. Then the answer is

    $$$\begin{cases} (p+1)^k & n\ \textrm{odd} \newline \dfrac{\left(2p\right)^k+p\cdot\left(\frac p2\right)^k}{p+1} & n\ \textrm{even} \end{cases}$$$

    How I got it:

    I brute-forced many small values (my brute force was $$$O(n2^{nk})$$$ and worked well enough for $$$n+k \leq 12$$$ (took only 80 seconds with pypy!). I immediately noticed the powers of $$$5$$$ and $$$17$$$, and checked for $$$65$$$ and $$$257$$$. For the evens, I noticed that $$$\textrm{ans}(2,k) = 3\cdot\textrm{ans}(2,k-1)-2$$$. I plugged this into Wolfram Alpha and got that it was $$$\frac{4^k+2}3$$$. Then, I tried brute forcing expressions in the form $$$\frac{a^k+b}c$$$ for $$$n = 4$$$, but found nothing. Then I tried changing the expression for $$$n=2$$$ to $$$\frac{4^k+2\cdot1^k}3$$$, and checked that form of expressions, and got $$$\textrm{ans}(4,k) = \frac{16^k + 8\cdot7^k}9$$$. From there I generalized it.

    The modular exponentiation makes the time complexity $$$O(\log n + \log k)$$$.

    Also, looking at submissions of random people, I've seen at least 4 different solutions other than mine (though they're all about $$$O(n+k)$$$, so mine is faster), so there are many ways to solve this problem.

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +4 Проголосовать: не нравится

    even is $$$\frac{\left(2^n\right)^k-\left(2^{n-1}-1\right)^k}{2^{n-1}+1}+\left(2^{n-1}-1\right)^k$$$.

  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +5 Проголосовать: не нравится

    Video solution, you can also convert the recurrence into a 1D DP (DP solution).

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'll probably fall to Specialist, but I really loved this round! Problem C was interesting, bit-manipulation and combinatorics puzzled me oh so good.

Kudos to the entire problem-setting team!

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can C be solved using DP?

I tried to implement via a 4-D dp dp[i][_and][_xor][eq].

At the ith bit (out of k), I have 4 ways of assigning bit combinations to the _and and _xor values -> 0 0, 0 1, 1 0, 1 1, and eq can be 0/1/2, denoting whether the & cumulative value until the ith bit is lesser, equal or greater than that of the ^ cumulative value. Couldn't implement the combinatorics part for each of the combinations in time. But, would this solution work?

  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится 0 Проголосовать: не нравится

    Clean dp:

    dp
    • »
      »
      »
      5 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +2 Проголосовать: не нравится

      not sure what I have done dp:

      ugly dp
  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится 0 Проголосовать: не нравится

    Count cEven the number of ways to pick an even number of 1's in an n-bit number. Then do dp on the most significant digits: if n is odd you have dp[i] = dp[i-1]*(cEven+1) (+1 is the case of all digits being ones). The second term is the number of ways the first digits can be equal. If n is odd then dp[i] = dp[i-1]*(cEven-1) + 2^(n*(i-1)). Here the second summand is the case of the first digit of the AND being larger than that of the XOR so any combination of digits other than the first works. The first summand is the digits being equals (you remove 1 because if all digits are 1 then there are an even number of them but then the AND term is larger). You can precompute the powers of 2 mod M as n is always the same.

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится -14 Проголосовать: не нравится

great contest

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +35 Проголосовать: не нравится

Well, it seems there is some disrespectful comments. Please respect the setter. For me C was good problem, and although I couldn't solve, E was also interesting. Thanks for the contest.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

one of the most balanced div 2s ever. Kudos to the authors !!

»
5 лет назад, скрыть # |
Rev. 4  
Проголосовать: нравится +25 Проголосовать: не нравится

I thought constraints to be different for C, so I solved it for $$$T \lt = 10^5$$$.

Solution
»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I wrote a solution of C but it was giving wrong answer on test case 2. Can someone explain what is wrong with the logic. I used 1-d dp. dp[0]=1 and for i from 1 to k - When n is even, dp[i]=2^(n*(k-1))+(2^(n-1)-1)*dp[i-1] - when n is odd, dp[i]=(2^(n-1)+1)*dp[i-1]. here is the link to my code

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

Nice round and keep going, guys :) It is sad to tell nowadays that many CF members don't like any problems, neither easy nor hard. They only like complaining and staying in comfort zone.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

One good thing about this contest is that I didn't face any lag today. The system was pretty smooth for me. The difficulty level of problem D was a bit on the hard side than a regular Div-2 D, to be honest. Overall, had a good time brainstorming. Thanks Mo2men & AhmedEzzatG for the contest.

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

What is the answer for this input in problem C: n= 1, k = 0. In my Accepted submission, it is 1. But I saw an accepted submission where it is 0.

https://mirror.codeforces.com/contest/1557/submission/125390194

I guess the setter didn't include this test in the system test.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Why the verdict of my submission is still Pretests passed? Problem B

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

why do tled guys not retested? seems like some correct solns for problem A got TL

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +12 Проголосовать: не нравится

A bad round:((((((

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

Feedback for authors -
Personally, I didn't like "Left", "Right" etc as King's movement. Giving dx,dy would have been nice.
I did spend a good amount of time hardcoding direction to dx,dy twice. After hardcoding once I realised switch(s) in C++ only accepts integers. Then I had change switch to map.

Spoiler

I completed the code in the last 5 mins and even after that it had a bug with one specific direction and would have costed an AC.

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +27 Проголосовать: не нравится

    Authors have just detected if you are able to write easy-to-debug/support code

    Click
  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +1 Проголосовать: не нравится

    I agree that it's important to make the problem statements in such a way that people can focus on the problem solving aspect, without getting too caught up in the coding "boilerplate".

    But this is competitive "programming" after all. Maybe it's just me, but I don't think it's bad to focus on the "programming" aspects from time to time ¯\_(ツ)_/¯

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

From HTI thanks Assiut university for the great ICPC community you made :)

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

I know I have poor abilities, but

How CRAZY the weak examples are!

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Gave this round could only solve 2, but expected I would at least not be unrated anymore. Why am I still unrated?

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

My solution for problem B remains the verdict "pretest passed". What's happening?

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +30 Проголосовать: не нравится

My solution for problem A got TLE on test case 2 on system tests (https://mirror.codeforces.com/contest/1557/submission/125328000)

After submitting the same code after system tests, it got AC (https://mirror.codeforces.com/contest/1557/submission/125407093)

If its possible to rejudge my submission, please do so.

UPD : Submission got rejudged and got AC!

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

I don't understand why my solution to question B is still showing me a pretest passed . I think it was not evaluated by the system . please tell me what to do.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +65 Проголосовать: не нравится

??? I wonder how this can be accepted 125408147

It just move like this ↓

And this worth 3000 points, the sum of Problem A, B, C.

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +19 Проголосовать: не нравится

    Just realised it's an interactive problem that supports hacking and there is no "Hacking format" section.
    Also, the problem statement doesn't mention if this problem is adaptive or not. It would be interesting if someone comments one can't hack this submission as well.

    Guessing hacking format from "Input" section in test cases and making one unsuccessful hack to validate hacking format I'm even sure one cant even hack any submissions because hacker cannot even control king's movement.

    The ideal format would have been hacker printing 131 king position with which interactor would have used to move king instead of hacker just supplying initial position and checker making decisions on rest 130 positions.

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    just realized this picture is from an earlier comment lul

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

I'd say that the problems are not too bad,because for me the first 3 problems are pretty ok for Div2 ABC problems,and E seems interesting.

The examples are kinda weak but i blame myself for not double checking. Also the tests in C and the interactor in E is weak,letting some incorrect solutions to pass.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +209 Проголосовать: не нравится

This is the best round I have ever seen, I can hardly imagine a round with a perfect balance and difficulty, the level of the authors is quite high, all levels of coders were able to get a perfect round, I felt physically and mentally happy when I played this game.

The questions in this cf were very interesting and I learned very many meaningful tricks from them, the difficulty slope was very reasonable, the sample coverage was very wide, and I even got a pass on the sample that only made the code pass.

What I admire about the author is that he has the courage to submit this kind of contest for review. If I had come up with such a topic, I would have been ashamed, but the author is open and honest, a real gentleman, he is the best courageous person I have ever met, bar none.

When I clicked on the leaderboard of the contest, I even wondered if I had clicked on the rating list. other low quality contests had purple and grey in the leaderboard, but in this contest, purple, blue, cyan and green were clearly defined, which made me admire the author from the bottom of my heart.

Finally, I wish the problem setter a long life, a happy family, good health and a speedy recovery from the loss of his mother.

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +11 Проголосовать: не нравится

Solution to E that passes tests with a limit of 21 queries per test case. 125414030

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится -39 Проголосовать: не нравится

Deleted

  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится -32 Проголосовать: не нравится

    Hey. Your code is correct but somehow taking lot of "doubles" as input is affecting time and hence TLE.

    Take int as input (very fast) and cast them to double, still your code works.

    i.e int x; cin>>x a[i] = x where a is "double array" it will pass.

    proof:

    include <bits/stdc++.h>

    using namespace std;

    int main(){ long long tt; cin>>tt; bool show = tt==3; while(tt--){ long long n; cin>>n; double a[n] = {0.0}; for(int i=0;i<n;i++) {

    //3 "show" int c; cin>>c; a[i]=c;

    /* only 2 "show" cin>>a[i] */ }

    if(show) cout<<"show\n";

    sort(a, a+n, greater()); double ans=0; for(int i=1;i<n;i++) ans+=a[i];

    int temp=n-1; ans/=temp; ans+=a[0]; printf("%.6f\n", ans); } }

    Above prints only 2 "show" for 2 test cases, indicating that TLE happened while taking input od 3rd test case.

    replace

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    It seems, you are using cin, cout which is pretty slower. And your execution time is significantly depending on I/O. If you use faster I/O (like scanf, printf), I think it will pass with double. FYI, Please just don't paste codes here, just link the submissions next time. :D

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

nice problemset, hard and interesting

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Out of curiosity, how did problemsetters create interactor for problem E? Seems hard.

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +31 Проголосовать: не нравится

    how did problemsetters create interactor for problem E?

    Not very well clearly, looking at the amount of wrong solutions that passed. The absence of a note on whether the interactor is adaptive, and the even more egregious absence of an explanation on how hacks work on the problem were red flags suggesting that the preparation of E was somewhat sloppy IMO...

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +27 Проголосовать: не нравится

To not keep you waiting, the ratings are updated preliminarily. In a few hours/days, I will remove cheaters and update the ratings again!

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -117 Проголосовать: не нравится

Good conpetition.But it's a pity that I miss it.

  • »
    »
    5 лет назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится -6 Проголосовать: не нравится

    i don't think that this is a good round, and i don't even understand why you think it's good round.

    I was hopeful about this race before it even started, but after the race, I thought this race was not a good contest.

    • »
      »
      »
      5 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +33 Проголосовать: не нравится

      I am curious why you think the contest was bad?

      One of the few problems I have seen was that the checker of E was not very solid, allowing lots of random solutions to pass, luckily, it didn't impact the official standings that much since only 6 people in the official standings solved E and I doubt that reason was the primary cause of complaints by DIV2 participants.

      Another reason that comes to my mind is that the samples for C weren't very strong, but otherwise I found the problems, at least A-C, elegant, in terms of the thought-process. Also, I couldn't find any Failed System Issues in this contest? Neither did I find any issues with the statements

      What is the deal with a lot of people complaining? Is it just a lot of people ranting who weren't satisfied with their performance?

      • »
        »
        »
        »
        5 лет назад, скрыть # ^ |
         
        Проголосовать: нравится -8 Проголосовать: не нравится

        Well, B was "simple problem hidden behind complecated statement". I am sure most of the participants who did not solve the problem immediately are upset about it.

      • »
        »
        »
        »
        5 лет назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        well, perhaps my words were too strong, i'm sorry about that.

        first, the samples are too weak; second, the 5th problem's data is very bad, allowing lots of random solutions to pass;

        i'm sorry to say this without careful analysis, but seriously, i dont like this round.

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +29 Проголосовать: не нравится

    I think you'd better evaluate the contest after reading the problems!

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится -9 Проголосовать: не нравится

    It's really a GREAT CONTEST!!! especially THE EXCELLENT INTERACTOR of problem E!!! :(

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -12 Проголосовать: не нравится

I have tried to make the pretests strong.

However, strong pretests ≠ weak example... :(

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem 1 have very obvious samples, some examiner doesn't realy understand it's principle but can accpect very quickly(true, include me ^_^).

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

In China, OIers have 'cordial greetings' to the people who write the questions

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -14 Проголосовать: не нравится

Nice round and Nice music!!! https://www.youtube.com/watch?v=9tIFSo_bEVY

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

I think the strong present tests $$$\not =$$$ weak samples.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How do we compress intervals in D ?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +45 Проголосовать: не нравится

Can you give me the reason for the weak samples and the weak system tests of problem E?

»
5 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится -31 Проголосовать: не нравится

[deleted comment]

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Nice,I failed.I am still a newbie.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +37 Проголосовать: не нравится

why am I unable to open the editorial. It's showing that you are not allowed to see the requested page.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +67 Проголосовать: не нравится

Actually I think this round is not that bad. Problems except E are in normal range of difficulty. Why are many people annoyed? I think there're only a few contestants affected by E for the fake solution. As for the weak samples, there's no obligation for problem setters to provide strong samples.

»
5 лет назад, скрыть # |
Rev. 4  
Проголосовать: нравится +4 Проголосовать: не нравится

Что за хрень такая? Нажимаю на разбор задач, выдает что не достаточно прав для просмотра страницы. Что делать?

What the hell is this? I click on the analysis of tasks, it says that there are not enough rights to view the page. What to do?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

"You are not allowed to view the requested page" Why you do this :( ?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +27 Проголосовать: не нравится

I am unable to access the tutorial of this contest. Why is this happening can someone please help.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someOne please tell me what will be the answer if we slightly change the B problem.

change: you can also reorder the subarray elements & still we have to make exactly K subarray.

I found it so hard for me because it took almost 1 hour for me & I couldn't solve it. after that, I read the actual problem then solved it, but here I am more curious to know the modified problem solution.

I think it becomes a good problem after modification.

can anyone please..? I also want you all to tell your approach.

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +12 Проголосовать: не нравится

Why is the tutorial blocked?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

why isn't the editorial visible ?

»
4 года назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

Nice Contest :D