# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3471 | pl0892029 | Jogging (kriii1_J) | C++98 | 1000 ms | 3224 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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=n-1; j>=0; j--){
if(z[i] <= x[j]){
res[i] = atan((double)y[j] / (x[j] - z[i]));
// printf("%lf\n", res[i]);
if(res[i]>max){
max=res[i];
}
} else{
res[i] = max;
break;
}
}
res[i] = max;
}
for(int i=0; i<m; i++){
printf("%.7lf\n", res[i]);
}
// while(true);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |