結果

問題 No.110 しましまピラミッド
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-03 06:25:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 948 bytes
コンパイル時間 2,244 ms
コンパイル使用メモリ 74,160 KB
実行使用メモリ 56,188 KB
最終ジャッジ日時 2023-08-30 03:57:23
合計ジャッジ時間 7,543 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,052 KB
testcase_01 AC 123 ms
55,832 KB
testcase_02 AC 124 ms
55,840 KB
testcase_03 AC 126 ms
56,072 KB
testcase_04 AC 127 ms
56,056 KB
testcase_05 AC 129 ms
55,968 KB
testcase_06 AC 127 ms
55,916 KB
testcase_07 AC 126 ms
55,916 KB
testcase_08 AC 127 ms
55,856 KB
testcase_09 AC 127 ms
55,828 KB
testcase_10 AC 126 ms
56,028 KB
testcase_11 AC 128 ms
55,840 KB
testcase_12 AC 128 ms
55,564 KB
testcase_13 AC 126 ms
55,844 KB
testcase_14 AC 126 ms
55,800 KB
testcase_15 AC 128 ms
55,848 KB
testcase_16 AC 128 ms
55,748 KB
testcase_17 AC 129 ms
55,892 KB
testcase_18 AC 126 ms
55,924 KB
testcase_19 AC 129 ms
55,968 KB
testcase_20 AC 126 ms
55,852 KB
testcase_21 AC 132 ms
55,960 KB
testcase_22 AC 126 ms
54,072 KB
testcase_23 AC 126 ms
55,884 KB
testcase_24 AC 127 ms
56,088 KB
testcase_25 AC 126 ms
56,028 KB
testcase_26 AC 127 ms
56,052 KB
testcase_27 AC 127 ms
55,844 KB
testcase_28 AC 129 ms
56,188 KB
testcase_29 AC 128 ms
55,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int Nw = sc.nextInt();
        int [] W = new int [Nw];
        for(int i=0; i<Nw; i++){
            W[i] = sc.nextInt();
        }
        Arrays.sort(W);
        int Nb = sc.nextInt();
        int [] B = new int [Nb];
        for(int i=0; i<Nb; i++){
            B[i] = sc.nextInt();
        }
        Arrays.sort(B);
        int rw=arrange(W,B,W[0]);
        int rb=arrange(B,W,B[0]);
        int ans=Math.max(rw,rb);
        System.out.println(ans);
    }
    static int arrange(int []a, int []b, int c){
        if(c>=b[b.length-1]){
            return 1;
        }else{
            for(int i=0; i<b.length; i++){
                if(c<b[i]){
                    c=b[i];
                    break;
                }
            }
            int x=1+arrange(b,a,c);
            return x;
        }
    }
}
0