結果
| 問題 | 
                            No.206 数の積集合を求めるクエリ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             FF256grhy
                         | 
                    
| 提出日時 | 2015-05-11 02:02:09 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 570 bytes | 
| コンパイル時間 | 109 ms | 
| コンパイル使用メモリ | 23,296 KB | 
| 実行使用メモリ | 7,808 KB | 
| 最終ジャッジ日時 | 2024-07-05 22:12:40 | 
| 合計ジャッジ時間 | 12,314 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 TLE * 1 -- * 12 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%d%d%d", &l, &m, &n);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:15:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         for(i = 0; i < l; i++) { scanf("%d", &a); bucket_a[a - 1] = 1; }
      |                                  ~~~~~^~~~~~~~~~
main.cpp:16:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         for(i = 0; i < m; i++) { scanf("%d", &b); bucket_b[b - 1] = 1; }
      |                                  ~~~~~^~~~~~~~~~
main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         scanf("%d", &q);
      |         ~~~~~^~~~~~~~~~
            
            ソースコード
// どのくらい時間がかかるかのテスト
#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;
}
            
            
            
        
            
FF256grhy