結果
| 問題 |
No.206 数の積集合を求めるクエリ
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-05-12 15:50:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6,970 ms / 7,000 ms |
| コード長 | 671 bytes |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 24,832 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-06 00:12:09 |
| 合計ジャッジ時間 | 30,734 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
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:16:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | fgets(buf, bufsize, stdin);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:20:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
20 | fgets(buf, bufsize, stdin);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int a[200010], b[100010], res[100010];
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);
fgets(buf, bufsize, stdin);
a[atoi(strtok(buf, " "))]=1;
for(int i=1;i<L;++i) a[atoi(strtok(NULL, " "))]=1;
fgets(buf, bufsize, stdin);
b[0]=atoi(strtok(buf, " "));
for(int i=1;i<M;++i) b[i]=atoi(strtok(NULL, " "));
Q=atoi(fgets(buf, bufsize, stdin));
while (Q--) {
int res=0;
for(int i=0;i<M;++i) res+=a[b[i]++];
printf("%d\n", res);
}
}
hogeover30