You are viewing a single comment's thread. Return to all comments →
Perl:
sub acmTeam { my $topics = shift; my $n = @$topics; my $m = $n > 0? length($topics->[0]): 0; my $max = 0; my $max_n = 0; for my $i (0 .. $n-2) { for my $j ($i + 1 .. $n-1) { my $st = 0; $st += (substr($topics->[$i], $_, 1) eq '1' || substr($topics->[$j], $_, 1) eq '1'? 1: 0) for (0..$m-1); if($st > $max) { $max = $st; $max_n = 1; } elsif($st == $max) { ++$max_n; } } } return ($max, $max_n); }
Seems like cookies are disabled on this browser, please enable them to open this website
ACM ICPC Team
You are viewing a single comment's thread. Return to all comments →
Perl: