QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#249939#2290. Kinking CablesFyind#WA 1ms3732kbC++172.3kb2023-11-12 18:20:012023-11-12 18:20:02

Judging History

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

  • [2023-11-12 18:20:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3732kb
  • [2023-11-12 18:20:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout<<#x<<':'<<x<<endl;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef long double ld;

ld dis(ld x1 ,ld y1,ld x2,ld y2){
    ld y=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
    return sqrt(y);
}
const ld eps=1e-9;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ld x,y,l;
    cin>>x>>y>>l;

    cout<<fixed<<setprecision(7);

    ld d=dis(0,0,x,y);
    if(l==d){
        cout<<2<<endl;
        cout<<0<<' '<<0<<endl;
        cout<<x<<' '<<y<<endl;
    }
    else if(l<=x+y){
        
        ld tl=0,tr=x;
        while(tl+eps<tr){

            ld mid=(tl+tr)/2;
            if(dis(0,0,mid,y)+(x-mid)<l){
                tr=mid;
            }
            else {
                tl=mid;
            }
        }

        cout<<3<<endl;
        cout<<0<<' '<<0<<endl;
        cout<<tl<<' '<<y<<endl;
        cout<<x<<' '<<y<<endl;


        // cout<<dis(0,0,tl,y)+(x-tl)<<endl;

    }
    else{
        ld f=5e-5;
        ld q=(l)-(x+y);
        q/=2;
        int r=q/x;
        ld g=q-r*x;
        vector<pair<ld,ld>>vc;
        vc.push_back({0,0});
        
        

        for(int i=0;i<r;i++){
            auto it=vc.back();
            ld tx=it.first,ty=it.second;
            vc.push_back({0,it.second+f});
            vc.push_back({x,it.second+f});
            vc.push_back({x,it.second+f+f});
            vc.push_back({0,it.second+f+f});
        }

        if(g>0){
            auto it=vc.back();
            ld tx=it.first,ty=it.second;
            vc.push_back({0,it.second+f});
            vc.push_back({g,it.second+f});
            vc.push_back({g,it.second+f+f});
            vc.push_back({0,it.second+f+f});
        }
        vc.push_back({0,y});
        vc.push_back({x,y});
        cout<<vc.size()<<endl;

        ld check=0;
        for(int i=0;i<vc.size();i++){
            cout<<vc[i].first<<' '<<vc[i].second<<endl;
            if(i==0) continue;
            else {
                check+=dis(vc[i-1].first,vc[i-1].second,vc[i].first,vc[i].second);
            }
        }
        // if(fabs(check-l)<eps){
        //     cout<<'#'<<endl;
        // }
        // else {
        //     cout<<'%'<<endl;
        // }
    }
    

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3732kb

input:

79 78
1980.7712136406

output:

51
0.0000000 0.0000000
0.0000000 0.0000500
79.0000000 0.0000500
79.0000000 0.0001000
0.0000000 0.0001000
0.0000000 0.0001500
79.0000000 0.0001500
79.0000000 0.0002000
0.0000000 0.0002000
0.0000000 0.0002500
79.0000000 0.0002500
79.0000000 0.0003000
0.0000000 0.0003000
0.0000000 0.0003500
79.0000000 ...

result:

wrong answer Output path has non-consecutive points within distance 1 of each other: (0.000000000000,0.000000000000) and (0.000000000000,0.000100000000)lie too close to each other