QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#804528#9869. Horizon Scanningucup-team1134#WA 176ms4300kbC++232.0kb2024-12-07 23:40:192024-12-07 23:40:20

Judging History

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

  • [2024-12-07 23:40:20]
  • 评测
  • 测评结果:WA
  • 用时:176ms
  • 内存:4300kb
  • [2024-12-07 23:40:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;

const double pi=acos(-1);

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int Q;cin>>Q;
    while(Q--){
        int N,K;cin>>N>>K;
        vector<double> S;
        for(int i=0;i<N;i++){
            int a,b;cin>>a>>b;
            double z=atan2(b,a);
            S.pb(z-2*pi);
            S.pb(z);
            S.pb(z+2*pi);
        }
        sort(all(S));
        
        double l=0,r=pi;
        
        for(int q=0;q<80;q++){
            double mid=(l+r)/2;
            vector<pair<double,double>> T;
            for(int i=0;i<2*N;i++){
                double a=S[i],b=S[i+K-1];
                if(b-a>mid*2) continue;
                T.pb(mp(b-mid,a+mid));
                //cout<<mid<<" "<<b-mid<<" "<<a+mid<<endl;
            }
            bool ok=true;
            double z=-pi;
            for(auto [a,b]:T){
                if(z<=pi&&z<a) ok=false;
                chmax(z,b);
            }
            if(z<pi) ok=false;
            if(ok) r=mid;
            else l=mid;
        }
        
        cout<<fixed<<setprecision(25)<<r*2<<"\n";
    }
}



詳細信息

Test #1:

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

input:

5
1 1
0 1
8 2
1 0
1 1
0 1
-1 1
-1 0
-1 -1
0 -1
1 -1
4 2
-1 1
0 1
0 2
1 1
4 2
-1000000000 0
-998244353 1
998244353 1
1000000000 0
3 1
0 1
0 2
0 -1

output:

6.2831853071795862319959269
1.5707963267948965579989817
5.4977871437821379529964361
3.1415926545915517920093407
3.1415926535897931159979635

result:

ok 5 numbers

Test #2:

score: -100
Wrong Answer
time: 176ms
memory: 4300kb

input:

10000
16 1
-10 -6
-5 -6
-4 9
-2 5
-2 10
1 -7
1 -5
1 6
3 1
4 -9
6 -10
6 -3
6 1
8 -5
8 -4
9 -4
17 4
-9 2
-8 -4
-8 -3
-8 -1
-6 -2
-6 -1
-6 8
-5 -8
-5 10
-4 8
-2 -8
4 -9
4 0
5 -3
8 -5
9 -2
10 10
10 6
-7 2
-4 6
-2 -7
-2 -1
-1 7
1 -9
1 8
3 -4
7 -4
9 -2
14 3
-9 10
-8 -10
-8 -8
-6 -7
-6 -5
-1 -7
-1 -2
0 -1
...

output:

2.3051439944313343310966502
2.5748634360662872033742588
4.6527582672535201524510740
2.7726331073839363128286095
5.7427658069090021797364898
4.8576989910203920430831204
3.4198923125949045598304110
2.8127999620848380679660750
6.2831853071795862319959269
6.2831853071795862319959269
5.117280766669773051...

result:

wrong answer 1st numbers differ - expected: '1.6929915', found: '2.3051440', error = '0.3615804'