Example #1
0
    static object Solve()
    {
        var n  = int.Parse(Console.ReadLine());
        var ps = Array.ConvertAll(new bool[n], _ => IntV.Parse(Console.ReadLine()));

        var gs = ps.GroupBy(p => p.X).OrderBy(g => g.Key).Select(g => g.OrderBy(p => p.Y).ToArray()).ToArray();

        var ps_u = GetUpper();
        var ps_l = GetLower();

        var area2 = GetArea2(ps_u) - GetArea2(ps_l);

        var lattices = 0L;

        lattices += gs[0][^ 1].Y - gs[0][0].Y;
Example #2
0
    static object Solve()
    {
        var n  = int.Parse(Console.ReadLine());
        var ps = Array.ConvertAll(new bool[n], _ => IntV.Parse(Console.ReadLine()));

        var  r  = 0;
        IntV tp = (1L, 0L);

        foreach (var p in ps.OrderBy(p => p - IntV.UnitX))
        {
            if (tp.CompareTo(p - IntV.UnitY) <= 0)
            {
                r++;
                tp = p - IntV.UnitX;
            }
        }

        return(r);
    }
Example #3
0
    static object Solve()
    {
        var n  = int.Parse(Console.ReadLine());
        var ps = Array.ConvertAll(new bool[n], _ => IntV.Parse(Console.ReadLine()));

        var r = 0;

        for (int i = 0; i < n; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                for (int k = j + 1; k < n; k++)
                {
                    var v1 = ps[i] - ps[j];
                    var v2 = ps[i] - ps[k];
                    if (!IntV.IsParallel(v1, v2))
                    {
                        r++;
                    }
                }
            }
        }
        return(r);
    }