結果

問題 No.647 明太子
ユーザー Freed_0929Freed_0929
提出日時 2018-02-09 23:13:50
言語 Java21
(openjdk 21)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,241 bytes
コンパイル時間 2,034 ms
コンパイル使用メモリ 73,912 KB
実行使用メモリ 65,056 KB
最終ジャッジ日時 2023-09-09 09:26:57
合計ジャッジ時間 8,577 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,236 KB
testcase_01 AC 117 ms
55,860 KB
testcase_02 AC 117 ms
55,960 KB
testcase_03 AC 117 ms
56,084 KB
testcase_04 AC 122 ms
55,788 KB
testcase_05 AC 122 ms
56,092 KB
testcase_06 AC 120 ms
56,420 KB
testcase_07 AC 128 ms
55,784 KB
testcase_08 AC 132 ms
55,868 KB
testcase_09 AC 193 ms
58,764 KB
testcase_10 AC 195 ms
58,696 KB
testcase_11 AC 178 ms
56,300 KB
testcase_12 AC 194 ms
58,624 KB
testcase_13 AC 201 ms
58,636 KB
testcase_14 AC 408 ms
61,300 KB
testcase_15 AC 225 ms
58,928 KB
testcase_16 AC 192 ms
58,536 KB
testcase_17 AC 443 ms
65,056 KB
testcase_18 AC 464 ms
63,528 KB
testcase_19 AC 318 ms
60,324 KB
testcase_20 AC 296 ms
60,524 KB
testcase_21 AC 231 ms
60,696 KB
testcase_22 AC 505 ms
64,644 KB
testcase_23 RE -
権限があれば一括ダウンロードができます

ソースコード

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