QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#526086#5667. Meeting Placessolar_express#Compile Error//C++143.3kb2024-08-21 10:55:352024-08-21 10:55:35

Judging History

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

  • [2024-08-21 10:55:35]
  • 评测
  • [2024-08-21 10:55:35]
  • 提交

answer

#include<bits/stdc++.h>
#define N 1005
#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){
        cir o={a[bg],0.0};
        cst[bg][bg]=0.0;
        for(int bg = bg+1;i < n;++i) {
            if(in(o, a[i])) 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 = 0;k < j;++k) {
                    if(in(o, a[k])) continue;
                    o = circumcenter(a[i], a[j], a[k]);
                }
            cst[bg][i]=o.r;
		}
	}
    }
    // for(int i=1;i<=n;++i){
    //     for(int j=i;j<=n;++j)
    //         cerr<<cst[i][j]<<" \n"[j==n];
    // }
    // 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<<setprecision(20)<<g[n][K]<<'\n';
    return 0;
}

Details

answer.code: In function ‘circle incircle(p2, p2, p2)’:
answer.code:26:93: error: could not convert ‘{operator/(operator+(operator+(operator*(a, A), operator*(b, B)), operator*(c, C)), ((A + B) + C)), (std::fabs(operator*(operator-(b, a), operator-(c, a))) / ((A + B) + C))}’ from ‘<brace-enclosed initializer list>’ to ‘circle’
   26 |         return {(a * A + b * B + c * C) / (A + B + C), fabs((b - a) * (c - a)) / (A + B + C)};
      |                                                                                             ^
      |                                                                                             |
      |                                                                                             <brace-enclosed initializer list>
answer.code: In function ‘circle circumcenter(p2, p2, p2)’:
answer.code:31:33: error: could not convert ‘{o, operator-(a, o).p2::abs()}’ from ‘<brace-enclosed initializer list>’ to ‘circle’
   31 |         return {o, (a - o).abs()};
      |                                 ^
      |                                 |
      |                                 <brace-enclosed initializer list>
answer.code: In function ‘circle cir(p2, p2)’:
answer.code:34:47: error: could not convert ‘{operator/(operator+(a, b), (long double)2), (operator-(a, b).p2::abs() / (long double)2)}’ from ‘<brace-enclosed initializer list>’ to ‘circle’
   34 |         return {(a + b) / 2, (a - b).abs() / 2};
      |                                               ^
      |                                               |
      |                                               <brace-enclosed initializer list>
answer.code: In function ‘int main()’:
answer.code:53:12: error: expected ‘;’ before ‘o’
   53 |         cir o={a[bg],0.0};
      |            ^~
      |            ;
answer.code:55:27: error: ‘i’ was not declared in this scope
   55 |         for(int bg = bg+1;i < n;++i) {
      |                           ^
answer.code:56:19: error: ‘o’ was not declared in this scope
   56 |             if(in(o, a[i])) continue;
      |                   ^
answer.code:57:13: error: ‘o’ was not declared in this scope
   57 |             o = cir(a[bg], a[i]);
      |             ^