PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000055. Chốt vuông và lỗ tròn (Square Pegs)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Chốt vuông và lỗ tròn (Square Pegs)

Square Pegs

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

There are round holes of radii rir_i, round pegs of radii cjc_j, and square pegs of side lengths sks_k. A hole holds at most one peg. A round peg fits if its radius is no larger than the hole radius; a square fits if its diagonal is no larger than the hole diameter. Maximize installed pegs.

Input

Line 1: counts n,m,kn,m,k of round holes, round pegs, square pegs. Line 2: nn hole radii rir_i. Line 3: mm round-peg radii cjc_j. Line 4: kk square-peg side lengths sis_i.

Output

Print the maximum number of pegs that fit.

Subtasks

  • Subtask 1 (20 points): 1≤n≤51\le n\le 5; 0≤m,k≤50\le m,k\le 5; 1≤ri,cj,si≤1091\le r_i,c_j,s_i\le 10^9 for all valid indices.
  • Subtask 2 (30 points): 1≤n≤5001\le n\le 500; 0≤m,k≤5000\le m,k\le 500; 1≤ri,cj,si≤1091\le r_i,c_j,s_i\le 10^9 for all valid indices.
  • Subtask 3 (50 points): 1≤n≤1000001\le n\le 100000; 0≤m,k≤1000000\le m,k\le 100000; 1≤ri,cj,si≤1091\le r_i,c_j,s_i\le 10^9 for all valid indices.

Examples

Input

3 1 2
2 3 4
2
4 5

Output

3

Explanation

The radius-2 hole holds the round peg of radius 2. Square side 4 needs radius 4/2≈2.8284/\sqrt2\approx2.828, fitting radius 3; square side 5 needs about 3.536, fitting radius 4. All three fit.