#C7038. Largest Clique

    ID: 50865 Type: Default 1000ms 256MiB

Largest Clique

Largest Clique

Given n balls numbered from 0 to n-1 and m pairs of interactions indicating which two balls can juggle with each other, find the size of the largest group (clique) in which every pair of balls interacts with each other.

A clique is defined as a subset of the balls such that for any two distinct balls \(i\) and \(j\) in the subset, there is an interaction between them. Mathematically, for a subset \(S\) to be a clique, it must satisfy:

\(\forall i, j \in S \ (i \neq j): A_{ij} = 1\), where \(A\) is the adjacency matrix of the interaction graph.

Your task is to compute the maximum size of such a clique.

inputFormat

The input is read from standard input (stdin) and has the following format:

n m
u1 v1
u2 v2
... 
um vm

Where:

  • n is the number of balls.
  • m is the number of interaction pairs.
  • Each of the next m lines contains two integers u and v representing an interaction pair between ball u and ball v.

outputFormat

Output the size of the largest clique (i.e. the maximum number of balls that all mutually interact) to standard output (stdout).

## sample
5 6
0 1
0 2
0 3
1 2
1 3
2 3
4