Submission #3434

# Submission time Handle Problem Language Result Execution time Memory
3434 2013-08-31T05:47:25 Z pl0892029 Jogging (kriii1_J) C++
0 / 1
1000 ms 3224 KB
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void){

	int n, m; // n은 별의 (x, y) 개수
		      // m은 휴식 취하는 x좌표(z) 개수
	scanf("%d %d", &n, &m);
	int *x = (int *)malloc(sizeof(int)*n);
	int *y = (int *)malloc(sizeof(int)*n);
	int *z = (int *)malloc(sizeof(int)*m);
	double *res = (double *) malloc(sizeof(double)*m);
	for(int i=0; i<n; i++){
		scanf("%d %d", &x[i], &y[i]);
	}
	for(int i=0; i<m; i++){
		scanf("%d", &z[i]);
		double max = 0.0000000;
		for(int j=0; j<n; j++){
			if(z[i]>x[j]){
				break;
			}
			res[i] = atan((double)y[j]/(x[j]-z[i]));
			//printf("%lf\n", res[i]);
			if(res[i]>max){
				max=res[i];
			}
		}
		res[i]=max;
	}

	for(int i=0; i<m; i++){
		printf("%.7lf\n", res[i]);
	}
	
	// while(true);



}
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 3224 KB Program timed out
2 Halted 0 ms 0 KB -