Description: Problem description:
A given integer m, composed of a vector A,,, and another by the n integers 1 2,,, maa L aia ≤ m 1 ≤ i ≤ m
Vector composed of B,,. Vector between A and B is defined as dist from: 1 2,,, nbb L bib ≤ n 1 ≤ i ≤ n
() (). 1, 1
, Min i m j n i j
dist A B a b
≤ ≤ ≤ ≤
=--
Vector directed away from the issue of the volume of requests to the distance between A and B.
For example, when m = 5, n = 5, corresponding to vector A: (-5,3,-5,2,4), vector B is: (-2,-3,-2,-3,-1)
When, dist (A, B) = 2.
Programming tasks:
For a given integer m, composed of a vector A,,, and another by the n 1 2,,, maa L aia ≤ m 1 ≤ i ≤ m
Integral component of the vector B,,, try to design a O (m+ n) time algorithm, namely 1 2,,, nbb L bib ≤ n 1 ≤ i ≤ n
Directional traffic count to the distance between A and B.
Data entry:
Provided by the input data file input.txt. Line 1 of the document are two positive integers m and n. Line 2 is an integer vector A:
. Line 3 is an integer vector
To Search:
- [RIPprogram] - a RIP distance vector implementation for
- [luyousuanfa] - Procedures for the preparation of a dyna
File list (Check if you may need any files):
dist_
.....\Debug
.....\.....\dist_.exe
.....\.....\dist_.ilk
.....\.....\dist_.obj
.....\.....\dist_.pch
.....\.....\dist_.pdb
.....\.....\vc60.idb
.....\.....\vc60.pdb
.....\dist.pdf
.....\dist.ppt
.....\dist_.cpp
.....\dist_.dsp
.....\dist_.dsw
.....\dist_.ncb
.....\dist_.opt
.....\dist_.plg
.....\ReadMe.txt
.....\StdAfx.cpp
.....\StdAfx.h