Last active
December 6, 2015 11:09
-
-
Save tsu-nera/9843be0b767d183aab9f to your computer and use it in GitHub Desktop.
SRM 436 Div2 250
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- 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