結果

問題 No.110 しましまピラミッド
ユーザー 37zigen37zigen
提出日時 2016-05-20 12:28:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 807 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 75,204 KB
実行使用メモリ 57,812 KB
最終ジャッジ日時 2023-08-30 03:54:21
合計ジャッジ時間 7,506 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
56,112 KB
testcase_01 AC 127 ms
55,948 KB
testcase_02 AC 127 ms
55,800 KB
testcase_03 AC 126 ms
55,788 KB
testcase_04 AC 122 ms
53,980 KB
testcase_05 AC 125 ms
55,820 KB
testcase_06 AC 123 ms
55,576 KB
testcase_07 AC 125 ms
55,876 KB
testcase_08 AC 125 ms
55,776 KB
testcase_09 AC 127 ms
55,772 KB
testcase_10 AC 127 ms
56,172 KB
testcase_11 AC 127 ms
56,084 KB
testcase_12 AC 127 ms
54,112 KB
testcase_13 AC 129 ms
55,804 KB
testcase_14 AC 127 ms
55,844 KB
testcase_15 AC 127 ms
55,984 KB
testcase_16 AC 129 ms
55,760 KB
testcase_17 AC 128 ms
57,812 KB
testcase_18 AC 127 ms
55,940 KB
testcase_19 AC 128 ms
55,832 KB
testcase_20 AC 126 ms
56,028 KB
testcase_21 AC 127 ms
55,764 KB
testcase_22 AC 127 ms
55,964 KB
testcase_23 AC 125 ms
55,924 KB
testcase_24 AC 129 ms
55,748 KB
testcase_25 AC 125 ms
55,964 KB
testcase_26 AC 125 ms
55,776 KB
testcase_27 AC 127 ms
56,084 KB
testcase_28 AC 125 ms
56,512 KB
testcase_29 AC 126 ms
55,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().solve();
	}
	void solve(){
		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(w);Arrays.sort(b);
		int res=0;
		for(int t=0;t<2;t++){
			int i=w.length-1;
			int j=b.length-1;
			int k=1000;
			int tmp=0;
			for(;;){
				while(i>=0&&w[i]>=k)i--;
				if(i<0)break;
				k=w[i];tmp++;i--;

				while(j>=0&&b[j]>=k)j--;
				if(j<0)break;
				k=b[j];tmp++;j--;
			}
			res=Math.max(res, tmp);
			int[] d=w;w=b;b=Arrays.copyOf(d,d.length);
		}
		System.out.println(res);
	}
}
0