結果

問題 No.110 しましまピラミッド
ユーザー 37zigen37zigen
提出日時 2016-05-20 12:24:38
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 803 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 77,236 KB
実行使用メモリ 56,560 KB
最終ジャッジ日時 2024-04-16 01:47:46
合計ジャッジ時間 6,777 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 113 ms
40,132 KB
testcase_03 WA -
testcase_04 AC 113 ms
40,420 KB
testcase_05 WA -
testcase_06 AC 125 ms
41,476 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 WA -
testcase_20 AC 129 ms
41,752 KB
testcase_21 AC 131 ms
41,460 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 113 ms
40,408 KB
testcase_25 WA -
testcase_26 RE -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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 i=w.length-1;
		int j=b.length-1;
		int k=1000;
		int res=0;
		int tmp=0;
		for(int t=0;t<2;t++){
			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[i];tmp++;j--;
			}
			res=Math.max(res, tmp);
			int[] d=w;w=b;b=Arrays.copyOf(d,d.length);
		}
		System.out.println(res);
	}
}
0