You are not logged in. Please login at www.codechef.com to post your questions!

×

# Codeforces Problem 758C Help

 0 Someone Please explain me the editorial as I am unable to understand the logic. Thanks in Advance :) asked 22 Feb '17, 12:55 46●6 accept rate: 0%

 1 Chef will start asking from students from 1st row to nth row and then from (n-1)th row to 2nd row. This constitutes 1 time period lets say. Thus, after every time period, chef will ask 1st row 1st student. In one time period except 1st and last row students, other students are asked 2 questions while former have been asked 1 question.Thus no. of questions asked in 1 period is T=nm+(n-2)m. Left out question is k%T. Now remaining questions are asked starting from 1st row 1st student. Now let f(x,y) denotes no. of questions asked to xth row yth column student no of periods,nt=k/T remaining = k%T f(1,y)=f(n,y)=nt f(x,y)=2*nt x>1&&x 0 && i < n; i++) for (j = 0; j < m && k > 0; j++) { f(i,j)++; k--; } Now simply iterate over all possible n,m and find max,min and questions asked to Sergei Complexity O(n*m) Hope it helps. In case of any doubt, you can comment. answered 25 Feb '17, 01:08 453●7 accept rate: 10%
 0 this is my solution: http://codeforces.com/contest/758/submission/25147009 answered 02 Mar '17, 17:37 174●5 accept rate: 13%
 toggle preview community wiki:
Preview

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×688

question asked: 22 Feb '17, 12:55

question was seen: 448 times

last updated: 02 Mar '17, 17:37