QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#658861#5667. Meeting Placesucup-team5234#WA 2ms3956kbC++232.2kb2024-10-19 17:47:562024-10-19 17:47:57

Judging History

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

  • [2024-10-19 17:47:57]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3956kb
  • [2024-10-19 17:47:56]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
ll MOD = 1000000007;
ll INF = (1ll<<60);
using ld = long double;
#define rep(i,n) for(int i=0;i<n;i++)

#define dout(a) cout << fixed << setprecision(20) << a << endl;

ld dis(ld x, ld y) {
    return x*x + y*y;
}
static const ld eps = 1e-11;
tuple<ld, ld, ld> solve(vector<pair<ld, ld>> p){
    int n = p.size();
    ld x = 0, y = 0;
    rep(i, n) {
        x += p[i].first;
        y += p[i].second;
    }
    x /= ld(n);
    y /= ld(n);
    ld r = 0.996;
    ld d = 1e9;
    
    rep(_, 6000) {
        int id = -1;
        ld m = -1;
        rep(i, n) {
            ld ret = dis(x - p[i].first, y - p[i].second);
            if(ret > m) {
                m = ret;
                id = i;
            }
        }
        ld X = p[id].first - x;
        ld Y = p[id].second - y;
        m = sqrtl(m);
        X /= m;
        Y /= m;
        X *= d;
        Y *= d;
        x += X;
        y += Y;
        d *= r;
    }
    ld m = -eps;
    rep(i, n) {
        ld ret = dis(x - p[i].first, y - p[i].second);
        if(ret > m) {
            m = ret;
        }
    }
    return {sqrtl(m), x, y};
}

int main(){
    
    ll n,k,X;
    cin >> n >> k >> X;
    if(n == k){
        cout << 0.0 << endl;
        return 0;
    }
    vector<ld> x(n), y(n);
    rep(i,n){
        x[i] = X;
        X = X*233811181+1;
        X %= (1ll<<31)-1;
        y[i] = X;
        X = X*233811181+1;
        X %= (1ll<<31)-1;
    }

    ld ans = INF;
    ld sx, sy, sr;
    ld ep = 1;
    {
        vector<pair<ld, ld>> p;
        for(int j=0; j<n-k+1; j++) p.emplace_back(x[j], y[j]);
        auto[r, x, y] = solve(p);
        ans = min(ans, r);
        sx = x, sy = y, sr = r;

    }
    for(int i=1; i+n-k+1<=n; i++){
        ld R = sqrtl(dis(sx - x[i-1], sy - y[i-1]));
        ld R2 = sqrtl(dis(sx - x[i+n-k], sy - y[i+n-k]));
        if(R > sr - ep || R2 > sr){
            vector<pair<ld, ld>> p;
            for(int j=i; j<i+n-k+1; j++) p.emplace_back(x[j], y[j]);
            auto[a,b,c] = solve(p);
            ans = min(ans, a);
            sr = a;
            sx = b;
            sy = c;
        }
    }
    dout(ans);




}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3956kb

input:

100 23 213

output:

1319350480.80073368758894503117

result:

ok found '1319350480.8007338', expected '1319350480.8007326', error '0.0000000'

Test #2:

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

input:

10 1 1060

output:

1042753143.34531159693142399192

result:

ok found '1042753143.3453116', expected '1042753143.3451676', error '0.0000000'

Test #3:

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

input:

10 10 2373

output:

0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #4:

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

input:

10 2 3396

output:

1236610536.94692303123883903027

result:

ok found '1236610536.9469230', expected '1236610536.9469230', error '0.0000000'

Test #5:

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

input:

10 3 1998

output:

973790809.82258929556701332331

result:

ok found '973790809.8225893', expected '973790809.8224442', error '0.0000000'

Test #6:

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

input:

10 4 562

output:

910867389.93836738134268671274

result:

ok found '910867389.9383674', expected '910867389.9069330', error '0.0000000'

Test #7:

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

input:

10 5 6048

output:

818240814.73156757920514792204

result:

ok found '818240814.7315676', expected '818240814.7105150', error '0.0000000'

Test #8:

score: -100
Wrong Answer
time: 1ms
memory: 3868kb

input:

10 6 2524

output:

674787674.31312931660795584321

result:

wrong answer 1st numbers differ - expected: '500106979.3467762', found: '674787674.3131293', error = '0.3492867'