結果

問題 No.206 数の積集合を求めるクエリ
ユーザー tottoripapertottoripaper
提出日時 2015-05-10 10:48:15
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 23,808 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 21:24:32
合計ジャッジ時間 10,911 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 11 ms
5,376 KB
testcase_19 AC 20 ms
5,376 KB
testcase_20 AC 11 ms
5,376 KB
testcase_21 WA -
testcase_22 AC 14 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%d", &b);
      |         ~~~~~^~~~~~~~~~
main.cpp:23:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |     scanf("%d", &Q);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

#include<cstdio>

int L, M, N;
unsigned 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>>5] |= 1u << (a&31);
    }
    for(int i=0;i<M;i++){
        int b;
        scanf("%d", &b);

        B[b>>5] |= 1u << (b&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);
    }
}
0