結果

問題 No.206 数の積集合を求めるクエリ
ユーザー kenkooookenkoooo
提出日時 2015-05-09 00:55:51
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 712 bytes
コンパイル時間 4,479 ms
コンパイル使用メモリ 78,148 KB
実行使用メモリ 69,780 KB
最終ジャッジ日時 2023-09-19 09:10:12
合計ジャッジ時間 25,319 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,780 KB
testcase_01 AC 130 ms
56,516 KB
testcase_02 AC 126 ms
55,468 KB
testcase_03 AC 126 ms
55,808 KB
testcase_04 AC 134 ms
55,580 KB
testcase_05 AC 146 ms
55,792 KB
testcase_06 AC 209 ms
58,876 KB
testcase_07 AC 205 ms
56,860 KB
testcase_08 AC 212 ms
59,160 KB
testcase_09 AC 209 ms
58,972 KB
testcase_10 AC 128 ms
55,972 KB
testcase_11 AC 147 ms
55,880 KB
testcase_12 AC 376 ms
60,468 KB
testcase_13 AC 368 ms
60,612 KB
testcase_14 AC 356 ms
60,620 KB
testcase_15 AC 339 ms
60,688 KB
testcase_16 AC 359 ms
59,948 KB
testcase_17 AC 711 ms
64,696 KB
testcase_18 AC 554 ms
62,804 KB
testcase_19 AC 671 ms
65,072 KB
testcase_20 AC 526 ms
60,548 KB
testcase_21 AC 570 ms
61,048 KB
testcase_22 AC 595 ms
60,520 KB
testcase_23 AC 682 ms
64,696 KB
testcase_24 AC 4,458 ms
65,360 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int M = sc.nextInt();
		int N = sc.nextInt();

		boolean[] A = new boolean[N];
		for (int i = 0; i < L; i++) {
			A[sc.nextInt() - 1] = true;
		}
		boolean[] B = new boolean[N];
		for (int i = 0; i < M; i++) {
			B[sc.nextInt() - 1] = true;
		}

		int Q = sc.nextInt();
		sc.close();

		int[] cnt = new int[Q];
		for (int i = 0; i < N; i++) {
			for (int q = 0; q < Q; q++) {
				if (i + q >= N) {
					break;
				}
				if (A[i + q] && B[i]) {
					cnt[q]++;
				}
			}
		}

		for (int i = 0; i < cnt.length; i++) {
			System.out.println(cnt[i]);
		}

	}
}
0