結果
問題 |
No.206 数の積集合を求めるクエリ
|
ユーザー |
![]() |
提出日時 | 2017-06-23 22:07:34 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 616 bytes |
コンパイル時間 | 255 ms |
コンパイル使用メモリ | 22,016 KB |
実行使用メモリ | 13,888 KB |
最終ジャッジ日時 | 2024-10-02 13:41:58 |
合計ジャッジ時間 | 9,811 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 TLE * 1 -- * 6 |
コンパイルメッセージ
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); | ^~~~~~~~~~~~~~
ソースコード
#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; }