結果

問題 No.110 しましまピラミッド
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-03 06:24:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 924 bytes
コンパイル時間 2,068 ms
コンパイル使用メモリ 73,912 KB
実行使用メモリ 58,332 KB
最終ジャッジ日時 2023-08-18 12:46:58
合計ジャッジ時間 7,126 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,668 KB
testcase_01 WA -
testcase_02 AC 127 ms
56,044 KB
testcase_03 AC 124 ms
55,552 KB
testcase_04 AC 125 ms
56,152 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 127 ms
55,996 KB
testcase_14 WA -
testcase_15 AC 126 ms
55,668 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 126 ms
55,548 KB
testcase_19 WA -
testcase_20 AC 127 ms
55,808 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 129 ms
56,076 KB
testcase_24 AC 127 ms
56,148 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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();
        }
        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