結果

問題 No.110 しましまピラミッド
ユーザー AreTrashAreTrash
提出日時 2016-06-12 22:16:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 2,161 bytes
コンパイル時間 3,084 ms
コンパイル使用メモリ 106,496 KB
実行使用メモリ 22,876 KB
最終ジャッジ日時 2023-08-30 03:54:13
合計ジャッジ時間 5,497 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
22,876 KB
testcase_01 AC 59 ms
20,864 KB
testcase_02 AC 60 ms
20,940 KB
testcase_03 AC 59 ms
22,832 KB
testcase_04 AC 59 ms
20,872 KB
testcase_05 AC 60 ms
20,852 KB
testcase_06 AC 60 ms
20,860 KB
testcase_07 AC 60 ms
22,712 KB
testcase_08 AC 59 ms
22,808 KB
testcase_09 AC 60 ms
20,864 KB
testcase_10 AC 60 ms
20,768 KB
testcase_11 AC 60 ms
20,736 KB
testcase_12 AC 59 ms
20,704 KB
testcase_13 AC 60 ms
20,800 KB
testcase_14 AC 61 ms
22,740 KB
testcase_15 AC 60 ms
20,880 KB
testcase_16 AC 60 ms
20,784 KB
testcase_17 AC 60 ms
20,792 KB
testcase_18 AC 58 ms
22,728 KB
testcase_19 AC 60 ms
20,728 KB
testcase_20 AC 59 ms
20,708 KB
testcase_21 AC 60 ms
18,724 KB
testcase_22 AC 60 ms
20,724 KB
testcase_23 AC 59 ms
20,828 KB
testcase_24 AC 60 ms
20,820 KB
testcase_25 AC 59 ms
22,772 KB
testcase_26 AC 59 ms
20,712 KB
testcase_27 AC 60 ms
20,848 KB
testcase_28 AC 60 ms
20,848 KB
testcase_29 AC 60 ms
20,776 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No110{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var n = new int[2];
            var block = new int[2][];
            for(var i = 0; i < 2; i++){
                n[i] = sr.Next<int>();
                block[i] = sr.Next<int>(n[i]);
                Array.Sort(block[i]);
            }

            var max = 0;
            for(var i = 0; i < 2; i++){
                var cColor = i;
                var cSize = 0;
                var height = 0;
                while(true){
                    var next = Array.BinarySearch(block[cColor], cSize + 1);
                    if(next <= -1)  next = ~next;
                    if(next == block[cColor].Length) break;
                    cSize = block[cColor][next];
                    cColor ^= 1;
                    height++;
                }
                max = Math.Max(max, height);
            }

            Console.WriteLine(max);
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = Console.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }
    }
}
0