結果

問題 No.110 しましまピラミッド
ユーザー NoNo
提出日時 2015-06-09 21:55:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 68 ms / 5,000 ms
コード長 2,884 bytes
コンパイル時間 2,288 ms
コンパイル使用メモリ 108,536 KB
実行使用メモリ 23,808 KB
最終ジャッジ日時 2023-08-30 03:48:40
合計ジャッジ時間 5,549 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
21,828 KB
testcase_01 AC 66 ms
21,852 KB
testcase_02 AC 66 ms
21,688 KB
testcase_03 AC 65 ms
21,860 KB
testcase_04 AC 66 ms
23,808 KB
testcase_05 AC 66 ms
21,792 KB
testcase_06 AC 65 ms
21,672 KB
testcase_07 AC 66 ms
21,792 KB
testcase_08 AC 67 ms
21,832 KB
testcase_09 AC 66 ms
21,788 KB
testcase_10 AC 65 ms
19,732 KB
testcase_11 AC 66 ms
19,676 KB
testcase_12 AC 67 ms
23,760 KB
testcase_13 AC 66 ms
21,836 KB
testcase_14 AC 66 ms
21,732 KB
testcase_15 AC 67 ms
21,872 KB
testcase_16 AC 66 ms
21,668 KB
testcase_17 AC 65 ms
21,784 KB
testcase_18 AC 65 ms
21,788 KB
testcase_19 AC 67 ms
21,668 KB
testcase_20 AC 66 ms
21,736 KB
testcase_21 AC 68 ms
21,828 KB
testcase_22 AC 66 ms
21,724 KB
testcase_23 AC 66 ms
21,732 KB
testcase_24 AC 66 ms
19,756 KB
testcase_25 AC 67 ms
19,848 KB
testcase_26 AC 66 ms
21,788 KB
testcase_27 AC 66 ms
19,868 KB
testcase_28 AC 67 ms
21,732 KB
testcase_29 AC 66 ms
21,744 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;
using System.Threading.Tasks;

namespace foryuki
{
    class Program
    {
        static void Main(string[] args)
        {
            int Nw = int.Parse(Console.ReadLine());
            int[] W = ConvertStringArrayToIntArray(Console.ReadLine().Split());
            int Nb = int.Parse(Console.ReadLine());
            int[] B = ConvertStringArrayToIntArray(Console.ReadLine().Split());


            int cnt1 = 0;
            int Wm = 0;
            int Bm = 0;

            while (true)
            {
                var q = from x in W
                        where x > Bm
                        orderby x
                        select x;

                if (q.Count() != 0)
                {
                    Wm = q.Min();
                    cnt1++;
                }
                else
                {
                    break;
                }

                var p = from x in B
                        where x > Wm
                        orderby x
                        select x;

                if (p.Count() != 0)
                {
                    Bm = p.Min();
                    cnt1++;
                }
                else
                {
                    break;
                }
            }

            //---------------------------

            int cnt2 = 0;
            Wm = 0;
            Bm = 0;

            while (true)
            {
                var p = from x in B
                        where x > Wm
                        orderby x
                        select x;

                if (p.Count() != 0)
                {
                    Bm = p.Min();
                    cnt2++;
                }
                else
                {
                    break;
                }

                var q = from x in W
                        where x > Bm
                        orderby x
                        select x;

                if (q.Count() != 0)
                {
                    Wm = q.Min();
                    cnt2++;
                }
                else
                {
                    break;
                }
            }

            Console.WriteLine(Math.Max( cnt1,cnt2));

        }


        //-------------------------------------------------------------

        static int[] ConvertStringArrayToIntArray(string[] str)
        {
            int[] b = Array.ConvertAll<string, int>(str, delegate(string value)
                {
                    return int.Parse(value);
                });
            return b;
        }

        static List<int> ConvertStringArrayToIntList(string[] str)
        {
            var list = new List<int>();
            foreach (var c in str)
            {
                list.Add(int.Parse(c));
            }
            return list;
        }
    }
}
0