結果

問題 No.206 数の積集合を求めるクエリ
ユーザー ciel
提出日時 2015-05-09 15:03:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1,029 ms / 7,000 ms
コード長 244 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 46,208 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 21:13:15
合計ジャッジ時間 8,400 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:47: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::size_t’ {aka ‘long unsigned int’} [-Wformat=]
    9 |         for(scanf("%d",&Q);Q--;b<<=1)printf("%d\n",(a&b).count());
      |                                              ~^    ~~~~~~~~~~~~~
      |                                               |               |
      |                                               int             std::size_t {aka long unsigned int}
      |                                              %ld
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d%d%d",&L,&M,&Q);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:7:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         for(;L--;)scanf("%d",&Q),a.set(Q);
      |                   ~~~~~^~~~~~~~~
main.cpp:8:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         for(;M--;)scanf("%d",&Q),b.set(Q);
      |                   ~~~~~^~~~~~~~~
main.cpp:9:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         for(scanf("%d",&Q);Q--;b<<=1)printf("%d\n",(a&b).count());
      |             ~~~~~^~~~~~~~~

ソースコード

diff #

#include <bitset>
#include <cstdio>
int main(){
	int L,M,Q;
	scanf("%d%d%d",&L,&M,&Q);
	std::bitset<1<<17>a,b;
	for(;L--;)scanf("%d",&Q),a.set(Q);
	for(;M--;)scanf("%d",&Q),b.set(Q);
	for(scanf("%d",&Q);Q--;b<<=1)printf("%d\n",(a&b).count());
}
0