結果

問題 No.206 数の積集合を求めるクエリ
ユーザー FF256grhyFF256grhy
提出日時 2015-05-11 02:02:09
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 570 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 25,696 KB
実行使用メモリ 8,180 KB
最終ジャッジ日時 2023-09-20 01:52:39
合計ジャッジ時間 16,961 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 17 ms
4,380 KB
testcase_07 AC 15 ms
4,376 KB
testcase_08 AC 22 ms
4,380 KB
testcase_09 AC 7 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 10 ms
4,376 KB
testcase_13 AC 8 ms
4,380 KB
testcase_14 AC 5 ms
4,376 KB
testcase_15 AC 2 ms
4,500 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// どのくらい時間がかかるかのテスト

#include <stdio.h>

#define MAX 100000

int l, m, n, q;
int bucket_a[MAX], bucket_b[MAX];
int memo[MAX];

int main(void) {
	int i, j;
	scanf("%d%d%d", &l, &m, &n);
	int a, b;
	for(i = 0; i < l; i++) { scanf("%d", &a); bucket_a[a - 1] = 1; }
	for(i = 0; i < m; i++) { scanf("%d", &b); bucket_b[b - 1] = 1; }
	scanf("%d", &q);
	
	for(i = 0; i < MAX; i++) { if(bucket_a[i]) {
	for(j = 0; j <= i;  j++) { if(bucket_b[j]) {
		memo[i - j]++;
	} }
	} }
	
	for(i = 0; i < q; i++) {
		printf("%d\n", memo[i]);
	}
	return 0;
}
0