結果

問題 No.110 しましまピラミッド
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-06-07 16:32:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 1,338 bytes
コンパイル時間 3,653 ms
コンパイル使用メモリ 74,872 KB
実行使用メモリ 56,348 KB
最終ジャッジ日時 2023-08-30 03:49:08
合計ジャッジ時間 8,965 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
56,172 KB
testcase_01 AC 132 ms
55,564 KB
testcase_02 AC 130 ms
55,916 KB
testcase_03 AC 130 ms
56,004 KB
testcase_04 AC 130 ms
55,760 KB
testcase_05 AC 131 ms
56,108 KB
testcase_06 AC 131 ms
56,056 KB
testcase_07 AC 131 ms
56,204 KB
testcase_08 AC 129 ms
55,732 KB
testcase_09 AC 132 ms
56,212 KB
testcase_10 AC 131 ms
56,348 KB
testcase_11 AC 132 ms
55,792 KB
testcase_12 AC 130 ms
55,796 KB
testcase_13 AC 130 ms
55,888 KB
testcase_14 AC 130 ms
55,540 KB
testcase_15 AC 131 ms
56,296 KB
testcase_16 AC 130 ms
56,028 KB
testcase_17 AC 131 ms
56,084 KB
testcase_18 AC 130 ms
55,872 KB
testcase_19 AC 131 ms
55,824 KB
testcase_20 AC 129 ms
55,560 KB
testcase_21 AC 129 ms
55,860 KB
testcase_22 AC 130 ms
56,144 KB
testcase_23 AC 130 ms
54,136 KB
testcase_24 AC 130 ms
55,892 KB
testcase_25 AC 131 ms
56,100 KB
testcase_26 AC 129 ms
55,932 KB
testcase_27 AC 130 ms
55,556 KB
testcase_28 AC 129 ms
55,796 KB
testcase_29 AC 130 ms
55,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No0110 {
    
    static final Scanner in = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        int nw = in.nextInt();
        wb = new int[2][];
        wb[0] = new int[nw];
        for (int i=0; i<nw; i++) wb[0][i] = in.nextInt();
        int nb = in.nextInt();
    	wb[1] = new int[nb];
    	for (int i=0; i<nb; i++) wb[1][i] = in.nextInt();
    	sort(wb[0]); sort(wb[1]);

    	//trace(wb);
    	out.println(count(0) > count(1) ? count(0) : count(1));
    }
   	
   	static int[][] wb;

    static int count(int f) {
    	int[] ptr = new int[2];
    	int res = 0, max = 0;
    	while (true) {
    		while (ptr[f%2] < wb[f%2].length && wb[f%2][ptr[f%2]] <= max) ptr[f%2]++;
    		if (ptr[f%2] == wb[f%2].length) return res;
    		res++;
    		max = wb[f%2][ptr[f%2]];
    		f++;
    	}
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        in.close();
        out.close();
    }

    static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}
0