結果
問題 | No.206 数の積集合を求めるクエリ |
ユーザー |
![]() |
提出日時 | 2015-05-09 00:11:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 825 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 24,064 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-05 20:52:12 |
合計ジャッジ時間 | 3,493 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 RE * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d %d %d", &L, &M, &N); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d", &a); | ~~~~~^~~~~~~~~~ main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%d", &b); | ~~~~~^~~~~~~~~~ main.cpp:46:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 46 | scanf("%d", &Q); | ~~~~~^~~~~~~~~~
ソースコード
// ゆったり #include <cstdio> int L, M, N; int A[100000], B[100000], C[100000], D[100000]; int counter[200000]; 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]; } for(int i=0;i<M;i++){ int b; scanf("%d", &b); ++B[--b]; } int v, next, t; for(int i=0,j;i<N;){ while(i < N && B[i] == 0){++i;} j = i; v = 0; while(j < N && B[j] == 1){ v += A[j++]; } counter[0] += v; next = j; t = 1; while(j < 2*N){ v += A[j++] - A[i++]; counter[t++] += v; } i = next; } scanf("%d", &Q); for(int i=0;i<Q;i++){ printf("%d\n", counter[i]); } }