結果

問題 No.206 数の積集合を求めるクエリ
ユーザー yaoshimaxyaoshimax
提出日時 2015-05-24 17:22:52
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 731 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 53,160 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 11:22:47
合計ジャッジ時間 3,786 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 12 ms
4,376 KB
testcase_13 AC 10 ms
4,376 KB
testcase_14 AC 10 ms
4,376 KB
testcase_15 AC 10 ms
4,376 KB
testcase_16 AC 9 ms
4,380 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
   int L,M,N;
   cin >> L >> M >> N;
   int A[L],B[M];
   int X[350]={0};
   int Y[350]={0};
   for(int i=0;i<L;i++){
      cin>>A[i];
      X[A[i]/30]|=1<<(A[i]%30);
   }
   for(int i=0;i<M;i++){
      cin>>B[i];
      Y[B[i]/30]|=1<<(B[i]%30);
   }
   int Q;
   cin >> Q;
   for( int i = 0 ; i<Q; i++){
      int ans =0;
      for( int j = 0 ; j < 350; j++){
         int c=(X[j]&Y[j]);
         while(c!=0){
            ans++;
            c&=(c-1);
         }
      }
      cout <<ans << endl;
      int carry = 0;
      for( int j = 0 ; j < 350; j++){
         Y[j]<<=1;
         Y[j]+=carry;
         carry=Y[j]/(1<<30);
         Y[j]%=(1<<30);
      }
   }
   return 0;
}
0