# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3935 | zzapcoder | Jogging (kriii1_J) | C++98 | 1000 ms | 4980 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 <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
class CRD{
public:
CRD(int _x, int _y)
: x(_x), y(_y)
{ }
int x,y;
};
std::vector<int> REST;
std::vector<CRD> STAR;
int N;
int M;
bool compareZZ(CRD A, CRD B)
{
if ( A.x < B.x )
return true;
else
return false;
}
int main()
{
scanf("%d%d",&N,&M);
for (int i = 0 ; i < N ; i++)
{
int tmpX, tmpY;
scanf("%d%d", &tmpX, &tmpY);
STAR.push_back( CRD(tmpX, tmpY) );
}
std::sort(STAR.begin(), STAR.end(), compareZZ);
for ( int i = 0 ; i < M ; i++)
{
int tmpX;
scanf("%d", &tmpX);
REST.push_back(tmpX);
}
for ( int i = 0 ; i < M ; i ++)
{
int pos = REST[i];
std::vector<CRD> STARTMP;
for ( int j = 0 ; j < N ; j++)
{
if ( pos < STAR[j].x )
STARTMP.push_back(STAR[j]);
}
if ( STARTMP.size() == 0 )
{
printf("0.0000000\n");
continue;
}
double tmpMax = STARTMP[0].y/(STARTMP[0].x - (double)pos );
for ( int j = 1 ; j < STARTMP.size() ; j++)
{
if ( tmpMax < (STARTMP[j].y/(STARTMP[j].x - (double)pos)) )
tmpMax = (STARTMP[j].y/(STARTMP[j].x - (double)pos));
}
// printf("pos: %d, tan : %.7lf\n", pos, tmpMax);
double Result = atan(tmpMax);
printf("%.7lf\n", Result);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |