結果
| 問題 |
No.206 数の積集合を求めるクエリ
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-05-10 11:01:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 577 bytes |
| コンパイル時間 | 126 ms |
| コンパイル使用メモリ | 23,808 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 21:25:27 |
| 合計ジャッジ時間 | 9,911 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d %d %d", &L, &M, &N);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d", &a);
| ~~~~~^~~~~~~~~~
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | scanf("%d", &b);
| ~~~~~^~~~~~~~~~
main.cpp:24:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
24 | scanf("%d", &Q);
| ~~~~~^~~~~~~~~~
ソースコード
#include<cstdio>
int L, M, N;
unsigned int A[7000], B[7000];
int Q;
int main(){
scanf("%d %d %d", &L, &M, &N);
for(int i=0;i<L;i++){
int a;
scanf("%d", &a);
A[a-1>>5] |= 1u << (a-1&31);
}
for(int i=0;i<M;i++){
int b;
scanf("%d", &b);
B[b-1>>5] |= 1u << (b-1&31);
}
scanf("%d", &Q);
for(int i=0;i<Q;i++){
int res = 0;
for(int j=0;j<(N+31)>>5;j++){
res += __builtin_popcount(A[j] & B[j]);
B[j] <<= 1;
}
printf("%d\n", res);
}
}
tottoripaper