Submission #3999

#TimeUsernameProblemLanguageResultExecution timeMemory
3999joonasJogging (kriii1_J)C++98
Compilation error
0 ms0 KiB
#include <stdio.h>
#include <utility>
#include <algorithm>
#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;
}

Compilation message (stderr)

J.cpp:9:47: error: invalid default argument for a template template parameter
J.cpp: In function 'int main()':
J.cpp:25:53: error: 'greater' is not a member of 'std'
J.cpp:25:53: error: 'greater' is not a member of 'std'
J.cpp:25:65: error: template argument 1 is invalid
J.cpp:18:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
J.cpp:21:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
J.cpp:28:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]