結果

問題 No.647 明太子
ユーザー shinwisteriashinwisteria
提出日時 2018-03-04 18:31:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 829 bytes
コンパイル時間 2,927 ms
コンパイル使用メモリ 74,216 KB
実行使用メモリ 64,952 KB
最終ジャッジ日時 2023-08-27 02:28:36
合計ジャッジ時間 9,089 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 111 ms
56,056 KB
testcase_02 AC 116 ms
55,780 KB
testcase_03 AC 116 ms
56,060 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 479 ms
64,952 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

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[i] >= count[N]){
						N = i;
					}
				}else{
					if(count[j] ==count[N] && count[N] != 0){
						System.out.println(j+1);
					}else if(count[N] == 0){
						System.out.println(N);
					}
				}
			}
		}
	}

}
0