結果

問題 No.647 明太子
ユーザー shinwisteriashinwisteria
提出日時 2018-03-06 19:25:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 542 ms / 4,500 ms
コード長 857 bytes
コンパイル時間 3,544 ms
コンパイル使用メモリ 75,672 KB
実行使用メモリ 64,700 KB
最終ジャッジ日時 2023-09-09 09:40:24
合計ジャッジ時間 10,422 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,624 KB
testcase_01 AC 124 ms
55,716 KB
testcase_02 AC 126 ms
55,344 KB
testcase_03 AC 128 ms
55,292 KB
testcase_04 AC 131 ms
55,552 KB
testcase_05 AC 129 ms
55,868 KB
testcase_06 AC 132 ms
55,548 KB
testcase_07 AC 143 ms
57,592 KB
testcase_08 AC 142 ms
55,924 KB
testcase_09 AC 195 ms
58,452 KB
testcase_10 AC 206 ms
58,752 KB
testcase_11 AC 192 ms
56,048 KB
testcase_12 AC 201 ms
58,728 KB
testcase_13 AC 219 ms
59,000 KB
testcase_14 AC 448 ms
60,964 KB
testcase_15 AC 241 ms
59,304 KB
testcase_16 AC 206 ms
58,752 KB
testcase_17 AC 464 ms
63,428 KB
testcase_18 AC 490 ms
63,108 KB
testcase_19 AC 343 ms
59,956 KB
testcase_20 AC 318 ms
60,540 KB
testcase_21 AC 241 ms
59,760 KB
testcase_22 AC 542 ms
64,700 KB
testcase_23 AC 172 ms
55,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Scanner;
public class Con647 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		int[][] ab = new int[N][2];
		for(int i = 0;i < N;i++){
			ab[i][0] = s.nextInt();
			ab[i][1] = s.nextInt();
		}
		int M = s.nextInt();
		int[] count = new int[M];
		for(int i = 0;i < M;i++){
			int x = s.nextInt() , y = s.nextInt();
			for(int j = 0;j < N;j++){
				if(ab[j][0] >= x && ab[j][1] <= y){
					count[i]++;
				}
			}
		}
		s.close();

		N = 0;
		for(int i = 0;i < 2;i++){
			for(int j = 0;j < M;j++){
				if(i == 0){
					if(count[j] >= count[N]){
						N = j;
					}
				}else{
					if(count[j] ==count[N] && count[N] != 0){
						System.out.println(j+1);
					}else if(count[N] == 0){
						System.out.println(0);
						break;    //未完成
					}
				}
			}
		}
	}

}
0