Comments

April Fools style Problems.

image

Because Alice and Bob always play games.

+18

You can copy 'p' from here and paste it.

Basically, here I'm checking whether a permutation is even or not?

Firstly, you need to know about The Number of Transpositions in a Permutation and Even and Odd Permutations and their theorems.

In the second link, you'll find a theorem.

Theorem

From the first link, you'll know that number of transpositions from a cycle = length of the cycle – 1.

So if a cycle's length is odd means the number of transpositions from it is even. Similarly, if a cycle's length is even means the number of transpositions from it is odd.

Now, in order to be an even permutation, a permutation must have the odd number transpositions cycle even number of times. (as mentioned in the theorem)

So, a permutation is even if it has odd number transpositions cycle even number of times means the even length cycles must be present even number of times.

(I hope I didn't make it complicated.)

I don't think it's a very well-known concept. I learned it yesterday. A large number of participants solved it using inversion count.

Also, you can solve this using DFS.

Suppose we have a permutation

-> 2 3 1 5 4

-> 1 2 3 4 5 (index)

If you create a graph you'll find some cycles. Here we have 2 cycles.

2-> 1 -> 3 -> 2 and 5 -> 4 -> 5

Here the first cycle has length 3 and the second cycle has length 2.

We can always sort any cycles having odd lengths using the operation described in the problem. So the number of cycles having odd lengths doesn't matter. On the other hand, If the number of cycles having even length is even then we can sort them otherwise we can't.

So if we have an even number of even length cycles then the answer is yes otherwise no.

You can find the length of a cycle using dfs.

Code

The duration of this contest was 135 minutes initially. The author accidentally wrote 150 minutes in the blog. (later it was changed into 150 minutes)

Successful hacking attempt

My bad.

Thanks :))

28/07 -> July Cook-Off 2021

29/07 -> Codeforces Round #735

30/07 -> Educational Codeforces Round 112

31/07 -> July Lunchtime 2021

31/07 -> AtCoder Beginner Contest 212

01/08 -> Leetcode Weekly Contest 252

01/08 -> Codeforces Round 736

Raining Contests

When 'A' is a curse
+18

Only $$$13$$$ testers!

Here's a list of 40 testers.

On lbm364dlScanf slower than cin ?, 5 years ago
+1

Have a look at this.

+25

Screenshot-393

Indeed

$$$1 \lt = a_i \lt = 2.5*10^6$$$

  • What does this mean?

This means there are at most $$$5*10^6$$$ possible sums.

  • So, if $$$n \gt sqrt( 5*10^6 )$$$ there is always a solution.

  • Stop when some sum is created twice.

  • Complexity $$$O(min(n^2,5*10^6))$$$

My Submission

Attention!

Unusual start time

On KingMaceWhat is it? Global vector, 5 years ago
+11

vector< int > name; Here we've only a vector.

vector< int >name [5]; Here we've 5 vectors. name[0] , name[1], name[2], name[3] and name[4].

Google it and learn details.

On KaeyCodeforces Round #701 (Div. 2), 5 years ago
+2

My sister brought a fried chicken for me at 8:30. I said I'll eat this after 10:35.

Thanks for the delay

If it takes so much time to reload use m1.codeforces.com , m2.codeforces.com or m3.codeforces.com.

I don't know the source but it works. I found this so many days ago here.

Screenshot-320

It hurts!

StopStalk. A tool to analyze and improve your Competitive Programming Progress. See DETAILS

If b divides a, then we can write (a/b) % p = a%(p*b) / b . Since we have to mod the floor value, we can ignore the condition above( b|a ). I used big mod to calculate a%(p*b) My submission

-26

But not a wonderful author.

When we'll get another Ashishgup round?

naturell

Check this out
0

AkshitDh

Your mistake

re_start

Test Case

What's the most useless talent you have?

Got it! Made a simple mistake.

I was unable to find out the reason behind MLE on test case 2 of this submission of problem 1382C1 - Prefix Flip (Easy Version). I've tried for a long to find out this. Can someone please tell me what is wrong with the code? My Submission -> 87609365