QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#728318#9576. Ordainer of Inexorable Judgmentucup-team3646#WA 1ms4164kbC++202.4kb2024-11-09 14:58:062024-11-09 14:58:10

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:58:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4164kb
  • [2024-11-09 14:58:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rep2(i, l, r) for(ll i = l; i < r; i++)

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

/* ---- */
#define all(A) A.begin(), A.end()
#define elif else if
using pii = pair<ll, ll>;

bool chmin(auto &a, const auto &b) {return a > b ? a = b, 1 : 0;}
bool chmax(auto &a, const auto &b) {return a < b ? a = b, 1 : 0;}

struct IOSetup {
  IOSetup() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
} iosetup;

template<class T>
void print(vector<T> a) {
  for (auto x : a) cerr << x << ' ';
  cerr << endl;
}

void print(auto x) {
  cerr << x << endl;
}


template<class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cerr << head << ' ';
  print(forward<Tail>(tail)...);
}

bool deb=0;
using ld=long double;
void solve(){
  int n;
  ld x0,y0,d,t;
  ld pi=atan2(1.0,1.0)*4.0;
  cin>>n>>x0>>y0>>d>>t;
  long double theta=atan2(y0,x0);
  vector<pair<ld,ld>> P(n);
  for(int i=0;i<n;i++){
    ld x,y;
    cin>>x>>y;
    P[i].first=cos(-theta)*x-sin(-theta)*y;
    P[i].second=sin(-theta)*x+cos(-theta)*y;
  }
  map<ld,int> th;
  vector<ld> IN(n),OUT(n);
  for(int i=0;i<n;i++){
    ld r=P[i].first*P[i].first+P[i].second*P[i].second;
    double intx=sqrt(r-d*d);
    ld phi=atan2(d,intx);
    ld psi=atan2(P[i].second,P[i].first);
    ld L=psi-phi;
    ld R=psi+phi;

    if(L<0.0)L+=2*pi;
    if(R<0.0)R+=2*pi;
    th[L]=1;
    th[R]=1;
    IN[i]=L;
    OUT[i]=R;
  }
  long long k = t / (2*pi);
  ld T=t-k*(2*pi);
  th[T]=1;
  int cnt=0;
  th[0]=1;
  th[2*pi]=1;
  vector<ld> realt;
  for(auto [key,val]:th){
    th[key]=cnt;
    realt.push_back(key);
    cnt++;
  }
  vector<int> D(cnt,0);
  for(int i=0;i<n;i++){
    int L=th[IN[i]];
    int R=th[OUT[i]];
    if(deb)cout<<L<<" "<<R<<endl;
    if(L<R){
      for(int p=L;p<R;p++){
        D[p]++;
      }
    }
    else{
      for(int p=L;p<cnt;p++){
        D[p]++;
      }
      for(int p=0;p<R;p++){
        D[p]++;
      }
    }
  }
  if(deb)for(int i=0;i<cnt;i++)cout<<D[i]<<" \n";
  ld an=0;
  for(int i=0;i<cnt-1;i++){
    ld len=realt[i+1]-realt[i];
    if(D[i]>0){
      if(i<th[T])an+=len*(k+1);
      else an+=len*k;
    }
    
  }
  cout<<fixed<<setprecision(15)<<an<<endl;
}

int main(){
  solve();
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4088kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.000000000000000

result:

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

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796326794897

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257475418

result:

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

Test #4:

score: 0
Accepted
time: 1ms
memory: 4164kb

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300290265

result:

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

Test #5:

score: 0
Accepted
time: 1ms
memory: 4140kb

input:

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

output:

2500.240670009608470

result:

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

Test #6:

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

input:

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

output:

1.872352644234754

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '1.8723526', error = '0.9996255'