Submission #42934012


Source Code Expand

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

namespace Tasks
{
    public class C
    {
        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 P = new HashSet<(int H, int W)>[3];
            for (var k = 0; k < 3; k++)
            {
                P[k] = new HashSet<(int H, int W)>();
                var (H, W) = Scanner.Scan<int, int>();

                for (var i = 0; i < H; i++)
                {
                    var s = Scanner.Scan<string>();
                    for (var j = 0; j < W; j++)
                    {
                        if (s[j] == '#')
                        {
                            P[k].Add((i, j));
                        }
                    }
                }
            }

            var A = P[0];
            var B = P[1];
            var X = P[2];

            for (var dia = -10; dia <= 10; dia++)
            {
                for (var dja = -10; dja <= 10; dja++)
                {
                    var a = A.Select(p => (p.H + dia, p.W + dja)).ToHashSet();
                    if (!a.IsSubsetOf(X)) continue;
                    for (var dib = -10; dib <= 10; dib++)
                    {
                        for (var djb = -10; djb <= 10; djb++)
                        {
                            var b = B.Select(p => (p.H + dib, p.W + djb));
                            if (a.Concat(b).ToHashSet().SetEquals(X))
                            {
                                Console.WriteLine("Yes");
                                return;
                            }
                        }
                    }
                }
            }

            Console.WriteLine("No");
        }

        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));
        }
    }
}

Submission Info

Submission Time
Task C - Ideal Sheet
User AconCavy
Language C# (.NET Core 3.1.201)
Score 300
Code Size 4537 Byte
Status AC
Exec Time 101 ms
Memory 31772 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 32
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt, example_03.txt
All example_00.txt, example_01.txt, example_02.txt, example_03.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, random2_00.txt, random2_01.txt, random2_02.txt, random2_03.txt, random2_04.txt, random2_05.txt, random2_06.txt, random2_07.txt, random2_08.txt, random2_09.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
Case Name Status Exec Time Memory
example_00.txt AC 88 ms 27860 KiB
example_01.txt AC 81 ms 28408 KiB
example_02.txt AC 89 ms 28396 KiB
example_03.txt AC 87 ms 27856 KiB
hand_00.txt AC 94 ms 31772 KiB
hand_01.txt AC 89 ms 28552 KiB
hand_02.txt AC 92 ms 28568 KiB
hand_03.txt AC 83 ms 28504 KiB
hand_04.txt AC 87 ms 29908 KiB
hand_05.txt AC 87 ms 28140 KiB
hand_06.txt AC 91 ms 28148 KiB
hand_07.txt AC 90 ms 28164 KiB
random2_00.txt AC 87 ms 28284 KiB
random2_01.txt AC 83 ms 28724 KiB
random2_02.txt AC 85 ms 28040 KiB
random2_03.txt AC 88 ms 28676 KiB
random2_04.txt AC 83 ms 28204 KiB
random2_05.txt AC 89 ms 28276 KiB
random2_06.txt AC 88 ms 28676 KiB
random2_07.txt AC 88 ms 29136 KiB
random2_08.txt AC 95 ms 28496 KiB
random2_09.txt AC 86 ms 28236 KiB
random_00.txt AC 88 ms 28944 KiB
random_01.txt AC 90 ms 28832 KiB
random_02.txt AC 90 ms 29668 KiB
random_03.txt AC 94 ms 29684 KiB
random_04.txt AC 88 ms 28472 KiB
random_05.txt AC 89 ms 29120 KiB
random_06.txt AC 101 ms 31420 KiB
random_07.txt AC 90 ms 28324 KiB
random_08.txt AC 89 ms 29392 KiB
random_09.txt AC 81 ms 29584 KiB