提出 #27664018


ソースコード 拡げる

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(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var (N, A, B) = Scanner.Scan<long, long, long>();
            var (P, Q, R, S) = Scanner.Scan<long, long, long, long>();
            var (H, W) = ((int)(Q - P + 1), (int)(S - R + 1));
            var (ch, cw) = ((int)(A - P), (int)(B - R));
            var answer = new char[H, W];
            for (var i = 0; i < H; i++)
            {
                for (var j = 0; j < W; j++)
                {
                    answer[i, j] = '#';
                }
            }

            for (var i = P; i <= Q; i++)
            {
                for (var j = R; j <= S; j++)
                {
                    var (dx, dy) = (A - i, B - j);
                    if (Math.Abs(dx) != Math.Abs(dy))
                    {

                        answer[(int)(i - P), (int)(j - R)] = '.';
                    }
                }
            }


            Printer.Print2D(answer, "");
        }

        public static class Printer
        {
            public static void Print<T>(T source) => Console.WriteLine(source);
            public static void Print1D<T>(IEnumerable<T> source, string separator = "") =>
                Console.WriteLine(string.Join(separator, source));
            public static void Print1D<T, U>(IEnumerable<T> source, Func<T, U> selector, string separator = "") =>
                Console.WriteLine(string.Join(separator, source.Select(selector)));
            public static void Print2D<T>(IEnumerable<IEnumerable<T>> source, string separator = "") =>
                Console.WriteLine(string.Join("\n", source.Select(x => string.Join(separator, x))));
            public static void Print2D<T, U>(IEnumerable<IEnumerable<T>> source, Func<T, U> selector, string separator = "") =>
                Console.WriteLine(string.Join("\n", source.Select(x => string.Join(separator, x.Select(selector)))));
            public static void Print2D<T>(T[,] source, string separator = "")
            {
                var (h, w) = (source.GetLength(0), source.GetLength(1));
                for (var i = 0; i < h; i++)
                    for (var j = 0; j < w; j++)
                    {
                        Console.Write(source[i, j]);
                        Console.Write(j == w - 1 ? "\n" : separator);
                    }
            }
            public static void Print2D<T, U>(T[,] source, Func<T, U> selector, string separator = "")
            {
                var (h, w) = (source.GetLength(0), source.GetLength(1));
                for (var i = 0; i < h; i++)
                    for (var j = 0; j < w; j++)
                    {
                        Console.Write(selector(source[i, j]));
                        Console.Write(j == w - 1 ? "\n" : separator);
                    }
            }
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (queue.Count == 0) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static (T1, T2, T3, T4, T5, T6) Scan<T1, T2, T3, T4, T5, T6>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>(), Next<T6>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}

提出情報

提出日時
問題 C - X drawing
ユーザ AconCavy
言語 C# (.NET Core 3.1.201)
得点 300
コード長 4517 Byte
結果 AC
実行時間 127 ms
メモリ 41624 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 35
セット名 テストケース
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, hand_11.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, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 86 ms 27492 KiB
example_01.txt AC 100 ms 27640 KiB
example_02.txt AC 82 ms 27700 KiB
hand_00.txt AC 98 ms 33496 KiB
hand_01.txt AC 117 ms 41152 KiB
hand_02.txt AC 119 ms 41480 KiB
hand_03.txt AC 116 ms 34144 KiB
hand_04.txt AC 107 ms 36708 KiB
hand_05.txt AC 78 ms 27608 KiB
hand_06.txt AC 97 ms 31368 KiB
hand_07.txt AC 102 ms 34676 KiB
hand_08.txt AC 99 ms 32472 KiB
hand_09.txt AC 100 ms 35368 KiB
hand_10.txt AC 120 ms 41624 KiB
hand_11.txt AC 121 ms 41000 KiB
random_00.txt AC 108 ms 38692 KiB
random_01.txt AC 108 ms 36144 KiB
random_02.txt AC 106 ms 36368 KiB
random_03.txt AC 105 ms 36392 KiB
random_04.txt AC 112 ms 34252 KiB
random_05.txt AC 117 ms 39668 KiB
random_06.txt AC 99 ms 33840 KiB
random_07.txt AC 95 ms 32680 KiB
random_08.txt AC 107 ms 35000 KiB
random_09.txt AC 94 ms 32888 KiB
random_10.txt AC 106 ms 37156 KiB
random_11.txt AC 81 ms 30104 KiB
random_12.txt AC 97 ms 34124 KiB
random_13.txt AC 102 ms 35108 KiB
random_14.txt AC 103 ms 35492 KiB
random_15.txt AC 83 ms 29084 KiB
random_16.txt AC 100 ms 34108 KiB
random_17.txt AC 84 ms 30012 KiB
random_18.txt AC 127 ms 36900 KiB
random_19.txt AC 95 ms 31504 KiB