#include #include #include #pragma GCC optimize("unroll-loops") #pragma GCC optimize("Ofast") using namespace std; double time ; int n , k ; vector> cp ; struct Runners { double speed; int px , py ; }; vector r ; void CR1( int x , int y ) { double mt = -1 ,dist ; int pos ; int sk = k ; for ( int i = 1 ; i <= sk ; i++ ) { dist = ((r[i].px-x) * (r[i].px-x)) + ((r[i].py-y) * (r[i].py-y)) ; dist = sqrt( dist ) ; dist *= r[i].speed ; if ( mt == -1 ) { mt = dist ; pos = i ; } else if ( dist < mt ) { mt = dist ; pos = i ; } } r[pos].px = x ; r[pos].py = y ; cout << pos << "\n" ; } void CR( int x , int y ) { double mt = -1 ,dist ; int pos ; int sk = k ; if ( sk > 100 ) sk = 100 ; for ( int i = 1 ; i <= sk ; i++ ) { dist = ((r[i].px-x) * (r[i].px-x)) + ((r[i].py-y) * (r[i].py-y)) ; dist = sqrt( dist ) ; dist *= r[i].speed ; if ( mt == -1 ) { mt = dist ; pos = i ; } else if ( dist < mt ) { mt = dist ; pos = i ; } } r[pos].px = x ; r[pos].py = y ; cout << pos << "\n" ; } int main() { ios_base::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL); #ifdef ONLINE_JUDGE freopen("runners.in", "r", stdin); freopen("runners.out", "w", stdout); #endif cin >> n >> k ; double s ; Runners vh ; vh.speed = 0 ; vh.px = 0 , vh.py = 0 ; r.push_back( vh ); for ( int i = 1 ; i <= k ; i++ ) { cin >> s ; vh.speed = s ; vh.px = -1 ; vh.py = -1 ; r.push_back( vh ) ; } int x , y ; cp.push_back( {0 , 0} ) ; for ( int i = 1 ; i <= n ; i++ ) { cin >> x >> y ; cp.push_back( {x , y} ) ; if ( i <= k ) { r[i].px = x ; r[i].py = y ; cout << x << " " << y << "\n" ; } } for ( int i = 1 ; i <= n ; i++ ) { if ( i <= k ) cout << i << endl ; else CR( cp[i].first , cp[i].second ) ; } return 0 ; }