結果

問題 No.110 しましまピラミッド
ユーザー kou6839kou6839
提出日時 2014-12-28 15:19:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,975 bytes
コンパイル時間 3,020 ms
コンパイル使用メモリ 75,552 KB
実行使用メモリ 58,044 KB
最終ジャッジ日時 2023-09-03 18:44:03
合計ジャッジ時間 8,871 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
55,656 KB
testcase_01 AC 108 ms
56,024 KB
testcase_02 AC 107 ms
55,844 KB
testcase_03 AC 108 ms
55,864 KB
testcase_04 AC 109 ms
55,752 KB
testcase_05 AC 108 ms
55,644 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 109 ms
55,468 KB
testcase_14 AC 110 ms
56,308 KB
testcase_15 AC 115 ms
55,712 KB
testcase_16 AC 110 ms
55,864 KB
testcase_17 AC 110 ms
55,472 KB
testcase_18 AC 110 ms
56,048 KB
testcase_19 AC 111 ms
55,844 KB
testcase_20 AC 109 ms
55,772 KB
testcase_21 AC 111 ms
58,044 KB
testcase_22 WA -
testcase_23 AC 118 ms
53,512 KB
testcase_24 AC 112 ms
56,172 KB
testcase_25 AC 112 ms
55,844 KB
testcase_26 AC 111 ms
55,712 KB
testcase_27 AC 109 ms
55,868 KB
testcase_28 AC 110 ms
55,568 KB
testcase_29 AC 109 ms
55,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PriorityQueue<Integer> siro = new PriorityQueue<>();
        PriorityQueue<Integer> kuro = new PriorityQueue<>();
        int nw = sc.nextInt();
        for(int i=0;i<nw;i++){
        	int aaaa=sc.nextInt();
        	siro.offer(-aaaa);
        }
        PriorityQueue<Integer> siro1 = new PriorityQueue<>(siro);
        int nb=sc.nextInt();
        for (int i = 0; i <nb; i++) {
        	int aaaa=sc.nextInt();
        	kuro.offer(-aaaa);
		}

        PriorityQueue<Integer> kuro1 = new PriorityQueue<>(kuro);
        int ans=1;
        int count1=1;
    	int now=-1*siro.poll();
        while(!kuro.isEmpty() || !siro.isEmpty()){
        	int bb=0;
        	while(!kuro.isEmpty()){
        		bb=-1*kuro.poll();
        		if(bb<now) break;
        	}
	        if(now>bb){ 
	        	now=bb;
	        	count1++;
	        }else{
	        	break;
	        }
	        int aa=0;
	        if(siro.isEmpty())break;
	        while(!siro.isEmpty()){
	        	aa=-1*siro.poll();
	        	if(now>aa)break;
	        }
	        if(now>aa){
	        	now=aa;
	        	count1++;
	        }else{
	        	break;
	        }
	     }
        ans=count1;
        int count2=1;
        int now1=-1*kuro1.poll();
        while(!kuro1.isEmpty() || !siro1.isEmpty()){
        	int bb=0;
        	while(!siro1.isEmpty()){
        		bb=-1*siro1.poll();
        		if(bb<now1) break;
        	}
	        if(now1>bb){ 
	        	now1=bb;
	        	count2++;
	        }else{
	        	break;
	        }
	        int aa=0;
	        if(kuro1.isEmpty()) break;
	        while(!kuro1.isEmpty()){
	        	aa=-1*kuro1.poll();
	        	if(aa<now1) break;
	        }
	        if(now1>aa){
	        	now1=aa;
	        	count2++;
	        }else{
	        	break;
	        }
	     }
        	ans=Math.max(ans, count2);
        	System.out.println(ans);
    }
}
0