提出 #45136636


ソースコード 拡げる

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;

namespace Tasks;

public class B
{
    public static void Main()
    {
        using var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }

    public static void Solve()
    {
        var N = Scanner.Scan<int>();
        var H = 100;
        var W = 100;
        var G = new bool[H + 1, W + 1];
        for (var i = 0; i < N; i++)
        {
            var (a, b, c, d) = Scanner.Scan<int, int, int, int>();
            for (var x = a; x < b; x++)
            {
                for (var y = c; y < d; y++)
                {
                    G[x, y] = true;
                }
            }
        }

        var answer = 0;
        for (var i = 0; i <= H; i++)
        {
            for (var j = 0; j <= W; j++)
            {
                if (G[i, j]) answer++;
            }
        }

        Console.WriteLine(answer);
    }

    public static class Scanner
    {
        public static T Scan<T>() where T : IConvertible => Convert<T>(ScanStringArray()[0]);
        public static (T1, T2) Scan<T1, T2>() where T1 : IConvertible where T2 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]));
        }
        public static (T1, T2, T3) Scan<T1, T2, T3>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]), Convert<T3>(input[2]));
        }
        public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]), Convert<T3>(input[2]), Convert<T4>(input[3]));
        }
        public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible where T5 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]), Convert<T3>(input[2]), Convert<T4>(input[3]), Convert<T5>(input[4]));
        }
        public static (T1, T2, T3, T4, T5, T6) Scan<T1, T2, T3, T4, T5, T6>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible where T5 : IConvertible where T6 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]), Convert<T3>(input[2]), Convert<T4>(input[3]), Convert<T5>(input[4]), Convert<T6>(input[5]));
        }
        public static IEnumerable<T> ScanEnumerable<T>() where T : IConvertible => ScanStringArray().Select(Convert<T>);
        private static string[] ScanStringArray()
        {
            var line = Console.ReadLine()?.Trim() ?? string.Empty;
            return string.IsNullOrEmpty(line) ? Array.Empty<string>() : line.Split(' ');
        }
        private static T Convert<T>(string value) where T : IConvertible => (T)System.Convert.ChangeType(value, typeof(T));
    }
}

提出情報

提出日時
問題 B - Overlapping sheets
ユーザ AconCavy
言語 C# 11.0 (.NET 7.0.7)
得点 200
コード長 3442 Byte
結果 AC
実行時間 46 ms
メモリ 24928 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 24
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 42 ms 24908 KiB
example_01.txt AC 46 ms 24596 KiB
example_02.txt AC 44 ms 24528 KiB
hand_00.txt AC 40 ms 24796 KiB
hand_01.txt AC 44 ms 24724 KiB
hand_02.txt AC 44 ms 24828 KiB
hand_03.txt AC 42 ms 24608 KiB
hand_04.txt AC 38 ms 24804 KiB
hand_05.txt AC 41 ms 24540 KiB
hand_06.txt AC 44 ms 24768 KiB
hand_07.txt AC 35 ms 24648 KiB
hand_08.txt AC 44 ms 24608 KiB
hand_09.txt AC 38 ms 24928 KiB
hand_10.txt AC 43 ms 24636 KiB
random_00.txt AC 42 ms 24732 KiB
random_01.txt AC 40 ms 24768 KiB
random_02.txt AC 36 ms 24664 KiB
random_03.txt AC 34 ms 24632 KiB
random_04.txt AC 39 ms 24648 KiB
random_05.txt AC 35 ms 24672 KiB
random_06.txt AC 33 ms 24568 KiB
random_07.txt AC 38 ms 24676 KiB
random_08.txt AC 30 ms 24644 KiB
random_09.txt AC 42 ms 24804 KiB