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.