TopCoder

User's AC Ratio

100.0% (1/1)

Submission's AC Ratio

100.0% (1/1)

Tags

Description

最近作物收成。小 E 可以賣新鮮蔥和蒜賺錢。他現在有 $n$ 根蔥和大蒜,每根蔥和每顆大蒜都有他的重量。
對於所有介在 $0$ 到 $n-1$ 之間的 $i$ 和 $j$ ,第 $i$ 根蔥的重量是 $a_i$,第 $j$ 顆大蒜的重量是 $b_j$。
他將蔥和大蒜按順序配對起來販售,他發現只要 蔥的重量 $\times$ 大蒜的重量 超過 $\texttt{threshold}$ 的組合都能成功賣出。
請你幫他計算按順序配對可以賣出多少份。

註:此題為互動題,請以下面的格式提交程式碼,你只需要完成函式的部分(提交時只要交包含以下部分的程式碼)。

#include "lib0603.h"
void array_filter(int n, int *a, int *b, int threshold, int &ans)
{
    // your code
}

Input Format

函式的參數請參考題敘。

  • $1 \leq n \leq 1000$
  • $1 \leq a_i,b_j \leq 1000$
  • $1 \leq \texttt{threshold} \leq 1000000$

請不要輸入任何東西。

Output Format

將答案存入 ans 中。
請不要輸出任何東西。

Sample Input 1

2 2
2 3
1 2

Sample Output 1

1

Hints

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0 範例測資 0
2 0~18 無額外限制 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 524288 65536 1 2
1 1000 524288 65536 2
2 1000 524288 65536 2
3 1000 524288 65536 2
4 1000 524288 65536 2
5 1000 524288 65536 2
6 1000 524288 65536 2
7 1000 524288 65536 2
8 1000 524288 65536 2
9 1000 524288 65536 2
10 1000 524288 65536 2
11 1000 524288 65536 2
12 1000 524288 65536 2
13 1000 524288 65536 2
14 1000 524288 65536 2
15 1000 524288 65536 2
16 1000 524288 65536 2
17 1000 524288 65536 2
18 1000 524288 65536 2