답안 #4241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
4241 2013-09-06T06:35:58 Z joonas Jogging (kriii1_J) C++
0 / 1
1000 ms 2880 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 2880 KB Program timed out
2 Halted 0 ms 0 KB -