結果

問題 No.206 数の積集合を求めるクエリ
ユーザー akakimidoriakakimidori
提出日時 2017-06-23 22:07:34
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 616 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 8,736 KB
最終ジャッジ日時 2024-04-10 11:42:51
合計ジャッジ時間 9,709 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,816 KB
testcase_01 AC 0 ms
6,940 KB
testcase_02 AC 0 ms
6,940 KB
testcase_03 AC 0 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 13 ms
6,944 KB
testcase_13 AC 6 ms
6,940 KB
testcase_14 AC 10 ms
6,940 KB
testcase_15 AC 13 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 22 ms
6,944 KB
testcase_18 AC 11 ms
6,940 KB
testcase_19 AC 20 ms
6,944 KB
testcase_20 AC 11 ms
6,940 KB
testcase_21 AC 14 ms
6,944 KB
testcase_22 AC 15 ms
6,944 KB
testcase_23 AC 20 ms
6,940 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%d%d%d",&l,&m,&n);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:15:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     scanf("%d",&p);
      |     ^~~~~~~~~~~~~~
main.c:21:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     scanf("%d",b+i);
      |     ^~~~~~~~~~~~~~~
main.c:24:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |   scanf("%d",&q);
      |   ^~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

#define get(p,n) ((p[(n)>>5]>>((n)&0x1F))&0x01)

void run(void){
  int l,m,n;
  scanf("%d%d%d",&l,&m,&n);

  unsigned int *a=(unsigned int *)calloc(100000,sizeof(int));
  int i;
  for(i=0;i<l;i++){
    int p;
    scanf("%d",&p);
    a[p>>5]|=(1<<(p&0x1F));
  }

  int *b=(int *)malloc(sizeof(int)*m);
  for(i=0;i<m;i++){
    scanf("%d",b+i);
  }
  int q;
  scanf("%d",&q);

  for(i=0;i<q;i++){
    int count=0;
    int j;
    for(j=0;j<m;j++){
      count+=get(a,b[j]+i);
    }
    printf("%d\n",count);
  }

  return;
}

int main(void){
  run();
  return 0;
}
0