結果

問題 No.647 明太子
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-13 19:50:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 423 ms / 4,500 ms
コード長 1,029 bytes
コンパイル時間 3,206 ms
コンパイル使用メモリ 73,912 KB
実行使用メモリ 60,640 KB
最終ジャッジ日時 2023-09-09 09:33:59
合計ジャッジ時間 9,759 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,036 KB
testcase_01 AC 116 ms
56,380 KB
testcase_02 AC 115 ms
56,124 KB
testcase_03 AC 118 ms
55,940 KB
testcase_04 AC 121 ms
56,076 KB
testcase_05 AC 120 ms
55,984 KB
testcase_06 AC 121 ms
56,176 KB
testcase_07 AC 130 ms
56,072 KB
testcase_08 AC 133 ms
56,332 KB
testcase_09 AC 191 ms
58,900 KB
testcase_10 AC 198 ms
59,504 KB
testcase_11 AC 178 ms
56,492 KB
testcase_12 AC 193 ms
58,444 KB
testcase_13 AC 206 ms
59,128 KB
testcase_14 AC 375 ms
60,500 KB
testcase_15 AC 221 ms
59,972 KB
testcase_16 AC 192 ms
58,388 KB
testcase_17 AC 416 ms
60,204 KB
testcase_18 AC 413 ms
60,400 KB
testcase_19 AC 317 ms
60,512 KB
testcase_20 AC 304 ms
60,036 KB
testcase_21 AC 233 ms
59,692 KB
testcase_22 AC 423 ms
60,640 KB
testcase_23 AC 176 ms
56,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No647 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(); //人数 N人
		int A[] = new int[N]; // 各自の値段の判断基準
		int 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];
		int Y[] = new int[M];
		int mentaiko[] = new int[M];
		for(int i = 0;i < M;i++) {
			X[i] = sc.nextInt();
			Y[i] = sc.nextInt();
			mentaiko[i] = 0;
		}
		int max = 0;

		// ここまで初期化 入力
		
		for(int i = 0;i < N;i++) {
			for(int j = 0;j < M;j++) {
				if(A[i] >= X[j] && B[i] <= Y[j]) {
					mentaiko[j]++;
				}
			}
		}
		
		for(int i = 0;i < M;i++) {
			if(max < mentaiko[i]) {
				max = mentaiko[i];
			}
		}
		
		if(max == 0) {
			System.out.println(0);
		}else {
			for(int i = 0;i < M;i++) {
				if(max == mentaiko[i]) {
					System.out.println(i + 1);
				}
			}
		}
	}
}
0