結果
問題 | No.206 数の積集合を求めるクエリ |
ユーザー | tottoripaper |
提出日時 | 2015-05-09 00:16:57 |
言語 | C++11 (gcc 11.4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 842 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 26,776 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-19 09:07:24 |
合計ジャッジ時間 | 3,843 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 5 ms
4,376 KB |
testcase_07 | AC | 4 ms
4,380 KB |
testcase_08 | AC | 5 ms
4,380 KB |
testcase_09 | AC | 3 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,380 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 2 ms
4,376 KB |
testcase_14 | AC | 2 ms
4,376 KB |
testcase_15 | AC | 2 ms
4,376 KB |
testcase_16 | AC | 2 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 | - |
ソースコード
// REgri-La Shower #include <cstdio> int L, M, N; int A[100000], B[100000]; int counter[200010]; 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;} if(i == N){break;} 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]); } }