QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#526134#5667. Meeting Placessolar_express#WA 63ms12304kbC++233.3kb2024-08-21 11:22:212024-08-21 11:22:22

Judging History

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

  • [2024-08-21 11:22:22]
  • 评测
  • 测评结果:WA
  • 用时:63ms
  • 内存:12304kb
  • [2024-08-21 11:22:21]
  • 提交

answer

#include<bits/stdc++.h>
#define N 2005
#define db long double
using namespace std;
int n,K;
const db eps = 1e-10;
db sgn(db x) { return x < -eps ? -1 : x > eps; }
db eq(db x, db y) { return !sgn(x - y); }
struct p2 {
	db x, y;
	db norm() const { return x * x + y * y; }
	db abs() const { return std::sqrt(x * x + y * y); }
	db arg() const { return atan2(y, x); }
}a[N];
p2 r90(p2 x) { return {-x.y, x.x}; }
p2 operator + (p2 x, p2 y) { return {x.x + y.x, x.y + y.y}; }
p2 operator - (p2 x, p2 y) { return {x.x - y.x, x.y - y.y}; }
p2 operator / (p2 x, db y) { return {x.x / y, x.y / y}; }
p2 operator * (p2 x, db y) { return {x.x * y, x.y * y}; }
p2 operator * (db y, p2 x) { return {x.x * y, x.y * y}; }
db operator * (p2 x, p2 y) { return x.x * y.y - x.y * y.x; }
db operator % (p2 x, p2 y) { return x.x * y.x + x.y * y.y; }
struct circle : p2 { db r; };
circle incircle(p2 a, p2 b, p2 c) {
	db A = (b - c).abs(), B = (c - a).abs(), C = (a - b).abs();
	return {(a * A + b * B + c * C) / (A + B + C), fabs((b - a) * (c - a)) / (A + B + C)};
} // 三点确定内心,不是最小圆覆盖内容
circle circumcenter(p2 a, p2 b, p2 c) { 
	p2 bc = c - b, ca = a - c, ab = b - a;
	p2 o = (b + c - r90(bc) * (ca % ab) / (ca * ab)) / 2;
	return {o, (a - o).abs()};
}// 三点确定外心
circle cir(p2 a, p2 b) { // 根据直径生成圆
	return {(a + b) / 2, (a - b).abs() / 2};
}
bool in(circle x, p2 y) { return (p2(x) - y).abs() <= x.r + eps; }
int gen(int x){
    return (1ll*x*233811181+1)%(2147483647);
}
db cst[N][N];
db f[N];
int st[N];
db g[N][N];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>K>>a[1].x;
    for(int i=1;i<=n;++i){
        if(i>=2) a[i].x=gen(a[i-1].y);
        a[i].y=gen(a[i].x);
    }
    for(int bg=1;bg<=n;++bg){
        circle o={a[bg],0.0};
        cst[bg][bg]=0.0;
        for(int i = bg+1;i <= n;++i) {
            if(in(o, a[i])){
                cst[bg][i]=o.r;
                continue;
            }
            o = cir(a[bg], a[i]);
            for(int j = bg;j < i;++j) {
                if(in(o, a[j])) continue;
                o = cir(a[j], a[i]);
                for(int k = bg;k < j;++k) {
                    if(in(o, a[k])) continue;
                    o = circumcenter(a[i], a[j], a[k]);
                }
            }
            cst[bg][i]=o.r;
	    }
    }
    // db L=-1e10,R=1e10;
    // cerr<<L<<" "<<R<<endl;
    // for(int t=1;t<=100;++t){
    //     db mid=(L+R)/2.0;
    //     f[0]=0;
    //     st[0]=0;
    //     for(int i=1;i<=n;++i){
    //         f[i]=1e18;
    //         for(int j=0;j<i;++j)
    //             if(f[i]>f[j]+cst[j+1][i]+mid)
    //                 f[i]=f[j]+cst[j+1][i]+mid,st[i]=st[j]+1;
    //     }
    //     if(st[n]>K) L=mid;
    //     if(st[n]==K){
    //         cout<<f[n]-mid*K<<'\n';
    //         return 0;
    //     }
    //     if(st[n]<K) R=mid;   
    //     cerr<<mid<<" "<<st[n]<<endl;    
    // }
    for(int i=0;i<=n;++i)
        for(int j=0;j<=K;++j) 
            g[i][j]=1e18;
    g[0][0]=0.0;
    for(int i=1;i<=n;++i)
        for(int j=0;j<i;++j)
            for(int k=1;k<=K;++k){
                g[i][k]=min(g[i][k],g[j][k-1]+cst[j+1][i]);
                cout<<i<<" "<<j<<" "<<k<<" "<<g[i][k]<<endl;
            }
    cout<<setprecision(20)<<g[n][K]<<'\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 63ms
memory: 12304kb

input:

100 23 213

output:

1 0 1 0
1 0 2 1e+18
1 0 3 1e+18
1 0 4 1e+18
1 0 5 1e+18
1 0 6 1e+18
1 0 7 1e+18
1 0 8 1e+18
1 0 9 1e+18
1 0 10 1e+18
1 0 11 1e+18
1 0 12 1e+18
1 0 13 1e+18
1 0 14 1e+18
1 0 15 1e+18
1 0 16 1e+18
1 0 17 1e+18
1 0 18 1e+18
1 0 19 1e+18
1 0 20 1e+18
1 0 21 1e+18
1 0 22 1e+18
1 0 23 1e+18
2 0 1 1.26085e...

result:

wrong answer 1st numbers differ - expected: '1319350480.8007326', found: '1.0000000', error = '1.0000000'