QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#728016#9576. Ordainer of Inexorable Judgmentucup-team073#WA 0ms4392kbC++204.8kb2024-11-09 14:23:152024-11-09 14:23:17

Judging History

你现在查看的是最新测评结果

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-14 21:58:28]
  • hack成功,自动添加数据
  • (/hack/1181)
  • [2024-11-09 14:23:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4392kb
  • [2024-11-09 14:23:15]
  • 提交

answer

#include<bits/stdc++.h>
#ifdef LOCAL
#define debug(...) printf(__VA_ARGS__)
#define edebug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#define edebug(...)
#endif
#define int ll
#define rep(i, x, y) for(int i = x; i <= y; ++i)
#define nrep(i, x, y) for(int i = x; i >= y; --i)
#define ll long long
#define pii std::pair<int,int>
#define pb emplace_back
#define fi first
#define se second
template <class T> 
inline void ckmax(T &a, T b) {
  if(a < b) a = b;
}
template <class T> 
inline void ckmin(T &a, T b) {
  if(a > b) a = b;
}
auto rt_YES = []{puts("YES");};
auto rt_Yes = []{puts("Yes");};
auto rt_NO = []{puts("NO");};
auto rt_No = []{puts("No");};
namespace IO {
#define isdigit(x) (x >= '0' && x <= '9')
  inline char gc() {
    return getchar();
  }
  inline bool blank(char ch) {
    return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
  }
  template <class T>
  inline void read(T &x) {
    double tmp = 1;
    bool sign = 0;
    x = 0;
    char ch = gc();
    for(; !isdigit(ch); ch = gc())
      if(ch == '-') sign = 1;
    for(; isdigit(ch); ch = gc())
      x = x * 10 + (ch - '0');
    if(ch == '.')
      for(ch = gc(); isdigit(ch); ch = gc())
        tmp /= 10.0, x += tmp * (ch - '0');
    if(sign) x = -x;
  }
  inline void read(char *s) {
    char ch = gc();
    for(; blank(ch); ch = gc());
    for(; !blank(ch); ch = gc())
      *s++ = ch;
    *s = 0;
  }
  inline void read(char &c) {
    for(c = gc(); blank(c); c = gc());
  }
  inline void push(const char &c) {
    putchar(c);
  }
  template <class T>
  inline void print(T x) {
    if(x < 0) {
      x = -x;
      push('-');
    }
    static T sta[35];
    T top = 0;
    do {
      sta[top++] = x % 10;
      x /= 10;
    } while(x);
    while(top)
      push(sta[--top] + '0');
  }
  template <class T>
  inline void print(T x, char lastChar) {
    print(x);
    push(lastChar);
  }
}
using namespace IO;

const double eps = 1e-8;
const double PI = acos(-1.0);

int sgn(double x)//符号函数,eps使用最多的地方
{
    if (fabs(x) < eps)
        return 0;
    if (x < 0)
        return -1;
    else
        return 1;
}

struct Point
{
    double x, y;
    Point() {}
    Point(double _x, double _y) : x(_x), y(_y) {}
    Point operator-(const Point &b) const { return Point(x - b.x, y - b.y); }
    Point operator+(const Point &b) const { return Point(x + b.x, y + b.y); }

    double operator^(const Point &b) const { return x * b.y - y * b.x; } //叉积
    double operator*(const Point &b) const { return x * b.x + y * b.y; } //点积

    bool operator<(const Point &b) const { return x < b.x || (x == b.x && y < b.y); }
    bool operator==(const Point &b) const { return sgn(x - b.x) == 0 && sgn(y - b.y) == 0; }

    Point Rotate(double B, Point P) //绕着点P,逆时针旋转角度B(弧度)
    {
        Point tmp;
        tmp.x = (x - P.x) * cos(B) - (y - P.y) * sin(B) + P.x;
        tmp.y = (x - P.x) * sin(B) + (y - P.y) * cos(B) + P.y;
        return tmp;
    }
}p[110];

int n,X,Y,d,t;
double Angle[210];
void solve(){
  read(n),read(X),read(Y),read(d),read(t);
  rep(i,1,n){
    int x,y;read(x),read(y);
    p[i].x=x,p[i].y=y;
  }
  rep(i,1,n){
    double AngleOX=atan2(p[i].y,p[i].x);
    double AngleOC=PI/2-acos(d/std::hypot(p[i].x,p[i].y));
    double A=AngleOX+AngleOC,B=AngleOX-AngleOC;
    // A=PI/2-A,B=PI/2-B;
    while(A>2*PI)A-=2*PI;
    while(B>2*PI)B-=2*PI;
    while(A<0)A+=2*PI;
    while(B<0)B+=2*PI;
    Angle[i*2-1]=A;
    Angle[i*2]=B;
    // debug("%lf %lf\n",AngleOX/(PI)*180,AngleOC/(PI)*180);
  }
  // rep(i,1,n*2+1)debug("%lf ",Angle[i]/(PI)*180);
  std::sort(Angle+1,Angle+n*2+1);
  Angle[n*2+1]=Angle[1]+2*PI;
  int Round=t/(2*PI);double Rest=t-Round*(2*PI);
  double ans=0;
  
  rep(i,1,n*2)if(Angle[i+1]-Angle[i]>=PI){
    // debug("%lf %lf\n",Angle[i+1]/(PI)*180,Angle[i]/(PI)*180);
    ans=Round*(2*PI-(Angle[i+1]-Angle[i]));
    double STA=atan2(Y,X),EDA=STA+Rest;
    double STR=Angle[i+1],EDR=Angle[i];
    if(STR>=2*PI)STR-=2*PI;
    if(STR>=EDR)EDR+=2*PI;
    ans+=std::max(0.0,std::min(EDA,EDR)-std::max(STA,STR));
    if(EDA>EDR&&STA>STR){
      EDA-=2*PI;
      ans+=std::max(0.0,std::min(EDA,EDR)-std::max(0.0,STR));
    }
    else if(EDA<EDR&&STA>STR){
      EDR-=2*PI;
      ans+=std::max(0.0,std::min(EDA,EDR)-std::max(STA,0.0));
    }
  }
  printf("%.12lf\n",ans);
}

signed main() {
  clock_t c1 = clock();
#ifdef LOCAL
  freopen("in.in", "r", stdin);
  freopen("out.out", "w", stdout);
#endif
//------------------------------------------------------------------

  solve();

//------------------------------------------------------------------
end:
  std::cerr << "Time : " << clock() - c1 << " ms" << std::endl;
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4288kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 4252kb

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796326795

result:

ok found '1.5707963', expected '1.5707963', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 4392kb

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257475

result:

ok found '2500.7077523', expected '2500.7077523', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 4316kb

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300289

result:

ok found '0.3842413', expected '0.3842413', error '0.0000000'

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 4324kb

input:

3 -10000 -10000 10000 10000
-10000 -9999
-10000 -10000
-9999 -10000

output:

2499.455171841211

result:

wrong answer 1st numbers differ - expected: '2500.2406700', found: '2499.4551718', error = '0.0003142'