QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#728409#9576. Ordainer of Inexorable Judgmentucup-team073WA 0ms4324kbC++203.7kb2024-11-09 15:07:192024-11-09 15:07:22

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 15:07:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4324kb
  • [2024-11-09 15:07:19]
  • 提交

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 PI = acos(-1.0);

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);
    double x=_x,y=_y;
    double AngleOX=atan2(y,x);
    double AngleOC=PI/2-acos(d/std::hypot(x,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",AngleOC/PI*180,AngleOX/PI*180);
    debug("%lf %lf\n",A/PI*180,B/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(STA<0)STA+=2*PI,EDA+=2*PI;
    if(STR>=2*PI)STR-=2*PI;
    if(STR>=EDR)EDR+=2*PI;
    debug("%lf %lf %lf %lf\n",STA,EDA,STR,EDR);
    ans+=std::max(0.0,std::min(EDA,EDR)-std::max(STA,STR));
    debug("%lf\n",ans);
    if(EDA>EDR&&STA>STR){
      EDA-=2*PI;
      ans+=std::max(0.0,EDA-STR);
    }
    else if(EDA<EDR&&STA<STR){
      EDR-=2*PI;
      ans+=std::max(0.0,EDR-STA);
    }
  }
  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;
}

詳細信息

Test #1:

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

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: 4132kb

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: 4300kb

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: 4308kb

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: 0
Accepted
time: 0ms
memory: 4260kb

input:

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

output:

2500.240670009608

result:

ok found '2500.2406700', expected '2500.2406700', error '0.0000000'

Test #6:

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

input:

4 1 0 1 10000
-2 3400
-4 10000
-4 -10000
-2 -3400

output:

4999.219115408742

result:

ok found '4999.2191154', expected '4999.2191154', error '0.0000000'

Test #7:

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

input:

4 1 0 1 10000
-2 3300
-4 10000
-4 -10000
-2 -3300

output:

4999.200391854815

result:

ok found '4999.2003919', expected '4999.2003919', error '0.0000000'

Test #8:

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

input:

4 -3040 2716 2147 2
-9033 -8520
-8999 -8533
-8988 -8511
-9004 -8495

output:

0.350830058342

result:

ok found '0.3508301', expected '0.3508301', error '0.0000000'

Test #9:

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

input:

3 8168 -766 1549 1256
-3951 -6425
-3874 -6439
-3911 -6389

output:

86.007096381760

result:

wrong answer 1st numbers differ - expected: '84.8328612', found: '86.0070964', error = '0.0138417'