結果

問題 No.893 お客様を誘導せよ
ユーザー naimonon77naimonon77
提出日時 2019-11-29 20:02:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 5,633 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 119,588 KB
実行使用メモリ 28,416 KB
最終ジャッジ日時 2024-11-20 21:36:17
合計ジャッジ時間 3,437 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
19,328 KB
testcase_01 AC 30 ms
19,456 KB
testcase_02 AC 52 ms
22,860 KB
testcase_03 AC 101 ms
25,728 KB
testcase_04 AC 99 ms
25,600 KB
testcase_05 AC 92 ms
25,472 KB
testcase_06 AC 72 ms
24,576 KB
testcase_07 AC 29 ms
19,328 KB
testcase_08 AC 174 ms
28,416 KB
testcase_09 AC 30 ms
19,840 KB
testcase_10 AC 28 ms
19,456 KB
testcase_11 AC 31 ms
19,712 KB
testcase_12 AC 33 ms
20,096 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
//using System.Text;
//using System.Threading.Tasks;
using System.IO;
using System.Runtime.CompilerServices;
////using System.Web.UI;
//using Debug = System.Diagnostics.Debug;
//// using System.Drawing.Primitives;
////using System.Drawing;
//using System.Windows;
using System.Numerics;

namespace ConsoleApp1
{
    class Program 
    {
        static void Main(string[] args)
        {
            new Solver().Solve();
        }
    }

    class GeneralPurposeClass {
        //public const double inf = double.PositiveInfinity;
        public const long inf = 1L << 50;
        public static readonly TextWriter error = Console.Error;
        public static Random random = new Random();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void Rep(int n_, Action<int> action)
        {
            for (int i = 0; i < n_; i++)
            {
                action(i);
            }
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void Rep2(int a, int n_, Action<int> action)
        {
            for (int i = a; i < n_; i++)
            {
                action(i);
            }
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void Rrep(int n_, Action<int> action)
        {
            for (int i = n_; i > -1; i--)
            {
                action(i);
            }
        }

        public static void TestReps()
        {
            var end = 3;
            var end2 = 10;
            error.WriteLine("rep ------");
            Dumpl("end", end);
            Rep(end, (i) =>
            {
                error.WriteLine(i);
            });

            error.WriteLine("");
            error.WriteLine("rep2 ------");
            var start = 7;
            Dumpl("start", start);
            Dumpl("end2", end2);
            Rep2(start, end2, (i) =>
            {
                error.WriteLine(i);
            });

            error.WriteLine("");
            error.WriteLine("rrep ------");
            Dumpl("end", end);
            Rrep(end, (i) =>
            {
                error.WriteLine(i);
            });
        }

        public static string ReadLine()
        {
            var s = Console.ReadLine();
            Dumpl("s", s);
            if (s.Length == 0) s = Console.ReadLine();
            var c = s[0];
            if (c == ' ' || c == '\n' || c == '\r') s = ReadLine();
            Dumpl("s", s);

            return s;
        }

        public static string ReadNext()
        {
            var s = "";
            while (true)
            {
                var c = Console.Read();
                if (c != ' ' && c != '\n' && c != '\r')
                {
                    s += (char)c;
                    break;
                }
            }
            while (true)
            {
                var c = Console.Read();
                if (c == ' ' || c == '\n' || c == '\r') break;
                s += (char)c;
            }
            return s;
        }

        public static long ReadLong()
        {
            return Stol(ReadNext());
        }

        public static int ReadInt()
        {
            return Stoi(ReadNext());
        }

        public static long Stol(string s)
        {
            return long.Parse(s);
        }

        public static int Stoi(string s)
        {
            return int.Parse(s);
        }


        public static void Write<T>(T a)
            where T : IComparable
        { Console.Write(a); }

        public static void WriteL<T>(T a)
            where T : IComparable
        { Console.WriteLine(a); }

        public static void Dump<T>(string s, T a)
            where T : IComparable
        {
#if DEBUG
            error.Write(s + ": " + a.ToString() + ' ');
#endif
        }

        public static void Dumpl<T>(string s, T a)
            where T : IComparable
        {
#if DEBUG
            Dump(s, a); error.WriteLine();
#endif
        }

        public int PowRandom(int a)
        {
            double nextDouble = NextDouble(a);
            return PowAndFloor(nextDouble);
        }

        public int PowAndFloor(double a)
        {
            return (int)Math.Floor(Math.Pow(10, a));
        }

        public double NextDouble(int a)
        {
            return random.NextDouble() * a;
        }

        public double NextDouble(double a)
        {
            return random.NextDouble() * a;
        }

        public void WriteForMakeSampleCase<T>(T a)
            where T : IComparable
        {
#if DEBUG
            return;
#endif
            WriteL(a);
        }
    }

    class Solver : GeneralPurposeClass
    {
        public void Solve()
        {
            var n = ReadInt();

            var a = new List<List<long>>();

            Rep(n, (i) =>
            {
                var p = ReadInt();
                var a_ = new List<long>();
                Rep(p, (i) =>
                {
                    a_.Add(ReadLong());
                });
                a.Add(a_);
            });

            var ans = new List<long>();
            for (int i = 0; ; i++)
            {
                bool done = false;
                Rep(n, (j) =>
                {
                    if (i < a[j].Count())
                    {
                        done = true;
                        ans.Add(a[j][i]);
                    }
                });
                if (done == false) break;
            }
            WriteL(string.Join(" ", ans));
        }
    }
}
0