結果
| 問題 |
No.206 数の積集合を求めるクエリ
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-05-12 16:02:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 655 bytes |
| コンパイル時間 | 542 ms |
| コンパイル使用メモリ | 46,108 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-06 00:08:06 |
| 合計ジャッジ時間 | 4,906 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 2 |
| other | AC * 1 RE * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::size_t’ {aka ‘long unsigned int’} [-Wformat=]
28 | printf("%d\n", (a&b).count());
| ~^ ~~~~~~~~~~~~~
| | |
| int std::size_t {aka long unsigned int}
| %ld
main.cpp:13:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | fgets(buf, bufsize, stdin);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:17:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | fgets(buf, bufsize, stdin);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:22:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | fgets(buf, bufsize, stdin);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
using namespace std;
const int bufsize=8*100010;
char buf[bufsize];
int main()
{
int L, M, N, Q;
fgets(buf, bufsize, stdin);
sscanf(buf, "%d%d%d", &L, &M, &N);
bitset<10> a;
fgets(buf, bufsize, stdin);
a.set(atoi(strtok(buf, " ")));
for(int i=1;i<L;++i) a.set(atoi(strtok(NULL, " ")));
bitset<10> b;
fgets(buf, bufsize, stdin);
b.set(atoi(strtok(buf, " ")));
for(int i=1;i<M;++i) b.set(atoi(strtok(NULL, " ")));
Q=atoi(fgets(buf, bufsize, stdin));
while (Q--) {
printf("%d\n", (a&b).count());
b<<=1;
}
}
hogeover30