# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
4269 | joonas | Jogging (kriii1_J) | C++98 | 1000 ms | 3392 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
vector<int> xs;
vector<double> res;
vector< pair<int,int> > ns;
int lastid;
bool descend(int i,int j){ return (i<j); }
void f( int x ){
//printf("%d ----\n", x );
int _dx = ns[lastid].first - x, _dy = ns[lastid].second;
double _ds = sqrt((double)(_dx*_dx)+(_dy*_dy));
double ret = asin(_dy/_ds);
int i = lastid;
for(; i >= 0; --i){
if( ns[i].first <= x ) break; //x1~
int dx = ns[i].first - x, dy = ns[i].second;
double ds = sqrt((double)(dx*dx)+(dy*dy));
if( asin(dy/ds) > asin(_dy/_ds) ){
ret = asin(dy/ds);
lastid = i;
}
//printf("(%d,%d):%.7f\n", ns[i].first, dy, asin(dy/ds));
}
//printf("[(%d,%d):%.7f]\n", ns[lastid].first, ns[lastid].second, ret);
res.push_back(ret);
}
int main(){
int i, n, m, x, y;
scanf("%d %d", &n, &m);
for(i=0; i < n; ++i){
scanf("%d %d", &x, &y);
ns.push_back( pair<int,int>(x,y) );
}
lastid = ns.size()-1;
for(i=0; i < m; ++i){
scanf("%d", &x);
xs.push_back( x );
}
for(i=xs.size()-1; i >= 0; --i) f(xs[i]);
for(i=res.size()-1; i >= 0; --i) printf("%.7f\n", res[i]);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |