제출 #4241

#제출 시각아이디문제언어결과실행 시간메모리
4241joonasJogging (kriii1_J)C++98
0 / 1
1000 ms2880 KiB
#include <stdio.h>
#include <utility>
#include <algorithm>
#include <functional>   // std::greater
#include <vector>
#include <cmath>

std::vector< std::pair<int,int> > N;
int M;
template < template <typename> class P = std::greater >
struct compare_pair_second {
    template<class T1, class T2> bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        return P<T2>()(left.second, right.second);
    }
};

int main(){
	int i,j, n, m;
	scanf("%d %d ", &n, &m);
	for(i=0; i < n; ++i){
		int nx, ny;
		scanf("%d %d ", &nx, &ny);
		N.push_back( std::pair<int,int>(nx, ny) );
	}

	std::sort( N.begin(), N.end(), compare_pair_second<std::greater>() );

	for(i=0; i < m; ++i){
		scanf("%d", &M);
		double rad=0.0;
		for(j=0; j < n; ++j){
			if( N[j].first > M ){
				double dw = N[j].first-M;
				double ds = sqrt((dw*dw)+((N[j].second)*(N[j].second)));
				double _r = asin(N[j].second/ds);
				if( _r > rad ) rad = _r;
			} else if( n >= 5 && j > n/2 ) break;
		}
		printf("%.7f\n", rad);
	}
	
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...