結果
| 問題 |
No.206 数の積集合を求めるクエリ
|
| コンテスト | |
| ユーザー |
angel_p_57
|
| 提出日時 | 2015-05-12 12:22:08 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 714 bytes |
| コンパイル時間 | 115 ms |
| コンパイル使用メモリ | 22,016 KB |
| 実行使用メモリ | 7,296 KB |
| 最終ジャッジ日時 | 2024-07-06 00:05:15 |
| 合計ジャッジ時間 | 9,194 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 TLE * 1 -- * 13 |
ソースコード
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
int main(void)
{
// input
int L,M,N,Q,ret;
ret=scanf("%d%d%d",&L,&M,&N);
assert(ret==3&&L>0&&M>0&&N>0&&L<=N&&M<=N);
int *abp = (int*)malloc(sizeof(int)*(L+M));
assert(abp);
for ( int i=0; i<L+M; i++ )
{
int *tp=&abp[i];
ret=scanf("%d",tp);
assert(ret&&*tp>=1&&*tp<=N);
}
int *A=&abp[0], *B=&abp[L];
ret=scanf("%d",&Q);
assert(ret&&Q>=1&&Q<=N);
// solve
int *R = (int*)calloc(Q,sizeof(int));
assert(R);
for ( int i=0; i<L; i++ )
for ( int j=0; j<M; j++ )
{
int v=A[i]-B[j];
if ( v>=0 && v<Q ) R[v]++;
}
// result
for ( int i=0; i<Q; i++ )
printf("%d\n",R[i]);
return 0;
}
angel_p_57