Skip to content

Instantly share code, notes, and snippets.

@tsu-nera
Last active December 6, 2015 11:09
Show Gist options
  • Select an option

  • Save tsu-nera/9843be0b767d183aab9f to your computer and use it in GitHub Desktop.

Select an option

Save tsu-nera/9843be0b767d183aab9f to your computer and use it in GitHub Desktop.
SRM 436 Div2 250
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect
class FriendScore:
def highestScore(self, friends):
n = len(friends)
ans = 0
for i in range(n):
cnt = 0
for j in range(n):
if i == j:
continue
if friends[i][j] == 'Y':
cnt = cnt + 1
else:
for k in range(n):
if friends[i][k] == 'Y'and friends[j][k] == 'Y':
cnt = cnt + 1
break
ans = max(ans, cnt)
return ans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment