Submission #2704349


Source Code Expand

using System;
using System.Linq;

namespace ABC47B
{
    class Program
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var W = int.Parse(input[0]);
            var H = int.Parse(input[1]);
            var N = int.Parse(input[2]);

            var map = new bool[H, W];
            for (var i = 0; i < N; i++)
            {
                var query = Console.ReadLine().Split(' ');
                var X = int.Parse(query[0]);
                var Y = int.Parse(query[1]);
                var A = int.Parse(query[2]);

                var lx = 0;
                var rx = W;
                var ty = H;
                var by = 0;

                if (A == 1) rx = X;
                if (A == 2) lx = X;
                if (A == 3) ty = Y;
                if (A == 4) by = Y;

                for (var y = by; y < ty; y++)
                for (var x = lx; x < rx; x++)
                {
                    map[y, x] = true;
                }
            }

            Console.WriteLine(map.Cast<bool>().Count(b => !b));
        }
    }
}

Submission Info

Submission Time
Task B - Snuke's Coloring 2 (ABC Edit)
User AreTrash
Language C# (Mono 4.6.2.0)
Score 200
Code Size 1162 Byte
Status AC
Exec Time 25 ms
Memory 11220 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
sample sample_01.txt, sample_02.txt, sample_03.txt
All dir_01.txt, dir_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt
Case Name Status Exec Time Memory
dir_01.txt AC 25 ms 11200 KB
dir_02.txt AC 25 ms 11200 KB
random_01.txt AC 24 ms 9152 KB
random_02.txt AC 24 ms 9152 KB
random_03.txt AC 24 ms 11200 KB
random_04.txt AC 24 ms 9152 KB
sample_01.txt AC 23 ms 11220 KB
sample_02.txt AC 22 ms 11220 KB
sample_03.txt AC 23 ms 11220 KB
small_01.txt AC 22 ms 11220 KB
small_02.txt AC 22 ms 9172 KB
small_03.txt AC 23 ms 11200 KB
small_04.txt AC 23 ms 11200 KB