結果

問題 No.647 明太子
ユーザー tsunabittsunabit
提出日時 2019-06-23 10:14:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 450 ms / 4,500 ms
コード長 999 bytes
コンパイル時間 3,344 ms
コンパイル使用メモリ 73,540 KB
実行使用メモリ 60,996 KB
最終ジャッジ日時 2023-08-27 03:21:38
合計ジャッジ時間 10,161 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,548 KB
testcase_01 AC 129 ms
55,900 KB
testcase_02 AC 128 ms
55,560 KB
testcase_03 AC 127 ms
55,940 KB
testcase_04 AC 131 ms
56,000 KB
testcase_05 AC 130 ms
56,096 KB
testcase_06 AC 129 ms
53,856 KB
testcase_07 AC 144 ms
55,980 KB
testcase_08 AC 143 ms
56,120 KB
testcase_09 AC 200 ms
58,524 KB
testcase_10 AC 207 ms
58,684 KB
testcase_11 AC 193 ms
56,184 KB
testcase_12 AC 208 ms
57,344 KB
testcase_13 AC 217 ms
58,856 KB
testcase_14 AC 416 ms
60,204 KB
testcase_15 AC 240 ms
59,852 KB
testcase_16 AC 209 ms
58,780 KB
testcase_17 AC 429 ms
60,004 KB
testcase_18 AC 424 ms
58,104 KB
testcase_19 AC 320 ms
60,136 KB
testcase_20 AC 317 ms
60,572 KB
testcase_21 AC 245 ms
59,092 KB
testcase_22 AC 450 ms
60,996 KB
testcase_23 AC 181 ms
55,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No647 {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	int[] a = new int[n], b = new int[n]; 
    	for(int i = 0; i < n; i++) {
    		a[i] = sc.nextInt();
    		b[i] = sc.nextInt();
    	}
    	
    	int m = sc.nextInt();
    	int[] x = new int[m], y = new int[m];
    	for(int i = 0; i < m; i++) {
    		x[i] = sc.nextInt();
    		y[i] = sc.nextInt();
    	}
    	
    	int[] o = new int[m];
    	
    	for(int i = 0; i < m; i++) {
    		for(int j = 0; j < n; j++) {
    			if(a[j] >= x[i] && b[j] <= y[i]) {
    				o[i] = o[i] + 1;
    			}
    		}
    	}
    	int max = 0;
    	for(int i = 0; i < m; i++) {
    		max = max < o[i]? o[i] : max;
    	}
    	if(max == 0) {
    		System.out.println(0);
    	}else {
    		for(int i = 0; i < m; i++) {
        		if(o[i] == max) {
        			System.out.println(i + 1);
        		}
        	}
    	}
    }
}
0