結果

問題 No.647 明太子
ユーザー Freed_0929
提出日時 2018-02-09 23:13:50
言語 Java
(openjdk 23)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,241 bytes
コンパイル時間 2,159 ms
コンパイル使用メモリ 77,376 KB
実行使用メモリ 62,748 KB
最終ジャッジ日時 2024-06-27 02:35:34
合計ジャッジ時間 8,868 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        int ans = 0;
        int[] result = new int[N];
        int c = 0;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            B[i] = sc.nextInt();
        }
        int M = sc.nextInt();
        int ch = 0;
        lavel:
        for (int i = 0; i < M; i++) {
            int X = sc.nextInt();
            int Y = sc.nextInt();
            ans=0;
            for (int j = 0; j < N; j++) {
                if (X <= A[j] && Y >= B[j]) {
                    ans++;
                }
            }
            if (ch <= ans && ans != 0) {
                if (ch == ans) {
                    c++;
                    result[c] = i + 1;
                } else {
                    Arrays.fill(result, 0);
                    ch = ans;
                    c = 0;
                    result[c] = i + 1;
                }
            }
        }
        for (int i = 0; result[i] != 0 || i == 0; i++) {
            System.out.println(result[i]);
        }
    }
}
0