divya8080's blog

By divya8080, history, 10 months ago, In English

I was trying to solve this problem: https://mirror.codeforces.com/contest/1487/problem/C and i came up with a wrong solution that i changed, now i know this modified solution works but its based on some assumptions that are:

  1. if n%2 = 0, then the optimal way is to tie a match between two teams such that each of them has no ties yet. And there is a way to get score = 0, in a way such that we make a team lose (n)/2-1 times and win (n)/2-1 times and 1 tie(assigned previously), also if this team has won/lost a match with any other team, we keep that in mind. So, we fill the grid of size n * n, such that each row(representing a team's matches has sum = 0), one thing that i need prove with is that once i have filled more than n/2 rows its possible to fill remaining such that their sum if 0, and only using -1/0/1 representing lose/tie/win.
  2. else, the optimal way is to have no ties and make each team lose (n-1)/2 times and win (n-1)/2 times. Here, i needed proof with :- Once I have filled more than n/2 rows, its possible to fill remaining with sum = 0 using only -1/0/1 representing lose/win/tie.

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By divya8080, history, 10 months ago, In English

I solved this problem(https://www.codechef.com/problems/SORTSUB7EZ) by using the assumption that:- "all the remainders of ai(wrt any integer) belong to set {0, 1, 2, ....,(ai+1)/2-1}" but idk the proof, can anyone help?

PS: i tried a few values of ai and found out that assumption.

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it