UNIVMT - Editorial

PROBLEM LINK:

Practice

Contest

Author: Arindam Baidya

Tester: Chinmay Rakshit

Editorialist: Chinmay Rakshit

DIFFICULTY:

CAKEWALK, SIMPLE, EASY

PREREQUISITES:

MATH, MODULO FUNCTION

PROBLEM:

Suppose you have a round table and each member are placed around this round table and when a person places a proposal than all the person in the roundtable asks a question except adjacent person including him.

QUICK EXPLANATION:

It’s a plane permutation question, suppose there are n persons and one person places proposal than n-3 persons places question so:

for 1 person n-3 questions

then for n persons n*(n-3) questions

but since there would be repetition so n*(n-3)/2 would be the result.

still there is a corner case:

if(n<=3) :

print(0)

else :

print(n*(n-3))%M

AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

Tester’s solution can be found here.

I am not clear as to how there are repititions and why it needs to be divided by 2.
Assume A and B are not adjacent. Surely, A will give proposal and B will ask a question, and the opposite will happen as well, that is B will give proposal and A will ask the question. But that’s two different questions, and the problem asks to count the total number of questions. Its a good question. Request you to not remove it. I can volunteer to fix the test cases.

THANK YOU