Esempio n. 1
0
            public void Solve()
            {
                int N = NextInt();
                int M = NextInt();

                var graph = new List <Li>();

                REP(N, _ => graph.Add(new Li()));
                REP(M, _ => {
                    int Ai = NextInt(), Bi = NextInt();
                    Ai--;
                    Bi--;
                    graph[Ai].Add(Bi);
                    graph[Bi].Add(Ai);
                });

                for (int i = 0; i < N; i++)
                {
                    var ans = new Li();
                    foreach (var item in graph[i])
                    {
                        if (item == i)
                        {
                            continue;
                        }
                        foreach (var under in graph[item])
                        {
                            if (under == i || under == item || graph[i].Contains(under))
                            {
                                continue;
                            }
                            ans.Add(under);
                        }
                    }
                    ans.Distinct().Count().WL();
                }
                return;
            }