QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#250007#2290. Kinking CablesFyind#AC ✓1ms3796kbC++172.1kb2023-11-12 19:52:052023-11-12 19:52:06

Judging History

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

  • [2023-11-12 19:52:06]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3796kb
  • [2023-11-12 19:52:05]
  • 提交

answer

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

ld dis(ld x1 ,ld y1,ld x2,ld y2){
    ld y=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
    return sqrt(y);
}
ld dis2(pii a,pii b){
    return dis(a.first,a.second,b.first,b.second);
}
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;
        return 0;
    }
    


    bool flag=false;
    if(x<y) {
        flag=true;
        swap(x,y);
    }
    vector<pii>vc;
    vc.push_back({0,0});



    auto it =vc.back();
    ld lc=l;
    //ld yy=y;

    if(l>x+y){
        while(true){
            vc.push_back({x-vc.back().first,vc.back().second});
            lc-=x;
            if(dis2(vc.back(),{0,y})+x>=lc){
                // debug(dis2(vc.back(),{0,y})+x);
                // debug(lc);
                break;
            }
            vc.push_back({vc.back().first,vc.back().second+1});
            lc--;
        }
    }

   //if(fabs(vc.back().first)<eps){
   

    ld tl=0,tr=x;
    while(tl+eps<tr){
        ld mid=(tl+tr)/2;
        if(dis(vc.back().first,vc.back().second,mid,y)+(x-mid)<lc){
            tr=mid;
        }
        else {
            tl=mid;
        }
    }

        vc.push_back({tl,y});
        vc.push_back({x,y});
    
        cout<<vc.size()<<endl;

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

}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3604kb

input:

79 78
1980.7712136406

output:

48
0.0000000 0.0000000
79.0000000 0.0000000
79.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
79.0000000 2.0000000
79.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
79.0000000 4.0000000
79.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
79.0000000 6.0000000
79.0000000...

result:

ok correct

Test #2:

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

input:

33 65
1947.7601065763

output:

60
0.0000000 0.0000000
0.0000000 65.0000000
1.0000000 65.0000000
1.0000000 0.0000000
2.0000000 0.0000000
2.0000000 65.0000000
3.0000000 65.0000000
3.0000000 0.0000000
4.0000000 0.0000000
4.0000000 65.0000000
5.0000000 65.0000000
5.0000000 0.0000000
6.0000000 0.0000000
6.0000000 65.0000000
7.0000000 ...

result:

ok correct

Test #3:

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

input:

51 51
555.0803652025

output:

20
0.0000000 0.0000000
51.0000000 0.0000000
51.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
51.0000000 2.0000000
51.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
51.0000000 4.0000000
51.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
51.0000000 6.0000000
51.0000000...

result:

ok correct

Test #4:

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

input:

49 2
67.3588717350

output:

4
0.0000000 0.0000000
49.0000000 0.0000000
39.9295033 2.0000000
49.0000000 2.0000000

result:

ok correct

Test #5:

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

input:

37 48
1713.3643608504

output:

70
0.0000000 0.0000000
0.0000000 48.0000000
1.0000000 48.0000000
1.0000000 0.0000000
2.0000000 0.0000000
2.0000000 48.0000000
3.0000000 48.0000000
3.0000000 0.0000000
4.0000000 0.0000000
4.0000000 48.0000000
5.0000000 48.0000000
5.0000000 0.0000000
6.0000000 0.0000000
6.0000000 48.0000000
7.0000000 ...

result:

ok correct

Test #6:

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

input:

51 79
820.1218304546

output:

20
0.0000000 0.0000000
0.0000000 79.0000000
1.0000000 79.0000000
1.0000000 0.0000000
2.0000000 0.0000000
2.0000000 79.0000000
3.0000000 79.0000000
3.0000000 0.0000000
4.0000000 0.0000000
4.0000000 79.0000000
5.0000000 79.0000000
5.0000000 0.0000000
6.0000000 0.0000000
6.0000000 79.0000000
7.0000000 ...

result:

ok correct

Test #7:

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

input:

6 8
37.5338494218

output:

8
0.0000000 0.0000000
0.0000000 8.0000000
1.0000000 8.0000000
1.0000000 0.0000000
2.0000000 0.0000000
2.0000000 8.0000000
6.0000000 2.9266859
6.0000000 8.0000000

result:

ok correct

Test #8:

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

input:

5 5
7.1908428511

output:

3
0.0000000 0.0000000
4.6101453 5.0000000
5.0000000 5.0000000

result:

ok correct

Test #9:

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

input:

5 4
8.3927665498

output:

3
0.0000000 0.0000000
0.6615744 4.0000000
5.0000000 4.0000000

result:

ok correct

Test #10:

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

input:

4 2
6.4617533647

output:

4
0.0000000 0.0000000
4.0000000 0.0000000
3.5815524 2.0000000
4.0000000 2.0000000

result:

ok correct

Test #11:

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

input:

91 87
4830.8473359767

output:

104
0.0000000 0.0000000
91.0000000 0.0000000
91.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
91.0000000 2.0000000
91.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
91.0000000 4.0000000
91.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
91.0000000 6.0000000
91.000000...

result:

ok correct

Test #12:

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

input:

90 90
5088.9280941138

output:

112
0.0000000 0.0000000
90.0000000 0.0000000
90.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
90.0000000 2.0000000
90.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
90.0000000 4.0000000
90.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
90.0000000 6.0000000
90.000000...

result:

ok correct

Test #13:

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

input:

90 92
7004.0153432299

output:

152
0.0000000 0.0000000
0.0000000 92.0000000
1.0000000 92.0000000
1.0000000 0.0000000
2.0000000 0.0000000
2.0000000 92.0000000
3.0000000 92.0000000
3.0000000 0.0000000
4.0000000 0.0000000
4.0000000 92.0000000
5.0000000 92.0000000
5.0000000 0.0000000
6.0000000 0.0000000
6.0000000 92.0000000
7.0000000...

result:

ok correct

Test #14:

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

input:

91 83
1879.3819547895

output:

40
0.0000000 0.0000000
91.0000000 0.0000000
91.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
91.0000000 2.0000000
91.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
91.0000000 4.0000000
91.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
91.0000000 6.0000000
91.0000000...

result:

ok correct

Test #15:

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

input:

3 81
199.2077743610

output:

4
0.0000000 0.0000000
0.0000000 81.0000000
3.0000000 21.9341814
3.0000000 81.0000000

result:

ok correct

Test #16:

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

input:

4 89
288.5915130114

output:

8
0.0000000 0.0000000
0.0000000 89.0000000
1.0000000 89.0000000
1.0000000 0.0000000
2.0000000 0.0000000
2.0000000 89.0000000
4.0000000 79.3063285
4.0000000 89.0000000

result:

ok correct

Test #17:

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

input:

95 3
175.9210001082

output:

4
0.0000000 0.0000000
95.0000000 0.0000000
54.5951097 3.0000000
95.0000000 3.0000000

result:

ok correct

Test #18:

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

input:

84 4
310.3037172015

output:

8
0.0000000 0.0000000
84.0000000 0.0000000
84.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
84.0000000 2.0000000
55.8836630 4.0000000
84.0000000 4.0000000

result:

ok correct

Test #19:

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

input:

2 2
2.8284271248

output:

3
0.0000000 0.0000000
2.0000000 2.0000000
2.0000000 2.0000000

result:

ok correct

Test #20:

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

input:

100 100
10000.0000000000

output:

198
0.0000000 0.0000000
100.0000000 0.0000000
100.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
100.0000000 2.0000000
100.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
100.0000000 4.0000000
100.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
100.0000000 6.0000000
10...

result:

ok correct

Test #21:

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

input:

100 100
9999.2500000000

output:

198
0.0000000 0.0000000
100.0000000 0.0000000
100.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
100.0000000 2.0000000
100.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
100.0000000 4.0000000
100.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
100.0000000 6.0000000
10...

result:

ok correct

Test #22:

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

input:

100 100
2723.8981892905

output:

52
0.0000000 0.0000000
100.0000000 0.0000000
100.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
100.0000000 2.0000000
100.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
100.0000000 4.0000000
100.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
100.0000000 6.0000000
100...

result:

ok correct

Test #23:

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

input:

100 100
8994.4904261819

output:

178
0.0000000 0.0000000
100.0000000 0.0000000
100.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
100.0000000 2.0000000
100.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
100.0000000 4.0000000
100.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
100.0000000 6.0000000
10...

result:

ok correct

Test #24:

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

input:

100 100
881.4998747190

output:

16
0.0000000 0.0000000
100.0000000 0.0000000
100.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
100.0000000 2.0000000
100.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
100.0000000 4.0000000
100.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
100.0000000 6.0000000
37....

result:

ok correct

Test #25:

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

input:

88 94
8266.2500000000

output:

176
0.0000000 0.0000000
0.0000000 94.0000000
1.0000000 94.0000000
1.0000000 0.0000000
2.0000000 0.0000000
2.0000000 94.0000000
3.0000000 94.0000000
3.0000000 0.0000000
4.0000000 0.0000000
4.0000000 94.0000000
5.0000000 94.0000000
5.0000000 0.0000000
6.0000000 0.0000000
6.0000000 94.0000000
7.0000000...

result:

ok correct

Test #26:

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

input:

75 37
2772.0000000000

output:

72
0.0000000 0.0000000
75.0000000 0.0000000
75.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
75.0000000 2.0000000
75.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
75.0000000 4.0000000
75.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
75.0000000 6.0000000
75.0000000...

result:

ok correct

Test #27:

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

input:

48 39
62.0000000000

output:

3
0.0000000 0.0000000
47.3214286 39.0000000
48.0000000 39.0000000

result:

ok correct

Test #28:

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

input:

98 94
135.9000000000

output:

3
0.0000000 0.0000000
97.6199208 94.0000000
98.0000000 94.0000000

result:

ok correct

Test #29:

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

input:

90 81
7290.0000000000

output:

160
0.0000000 0.0000000
90.0000000 0.0000000
90.0000000 1.0000000
0.0000000 1.0000000
0.0000000 2.0000000
90.0000000 2.0000000
90.0000000 3.0000000
0.0000000 3.0000000
0.0000000 4.0000000
90.0000000 4.0000000
90.0000000 5.0000000
0.0000000 5.0000000
0.0000000 6.0000000
90.0000000 6.0000000
90.000000...

result:

ok correct

Test #30:

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

input:

90 81
121.0826164250

output:

3
0.0000000 0.0000000
90.0000000 81.0000000
90.0000000 81.0000000

result:

ok correct

Test #31:

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

input:

34 99
3366.0000000000

output:

68
0.0000000 0.0000000
0.0000000 99.0000000
1.0000000 99.0000000
1.0000000 0.0000000
2.0000000 0.0000000
2.0000000 99.0000000
3.0000000 99.0000000
3.0000000 0.0000000
4.0000000 0.0000000
4.0000000 99.0000000
5.0000000 99.0000000
5.0000000 0.0000000
6.0000000 0.0000000
6.0000000 99.0000000
7.0000000 ...

result:

ok correct

Test #32:

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

input:

34 99
104.6756896330

output:

3
0.0000000 0.0000000
34.0000000 99.0000000
34.0000000 99.0000000

result:

ok correct

Test #33:

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

input:

3 3
5.9999

output:

3
0.0000000 0.0000000
0.0001000 3.0000000
3.0000000 3.0000000

result:

ok correct

Test #34:

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

input:

3 3
6.0

output:

3
0.0000000 0.0000000
0.0000000 3.0000000
3.0000000 3.0000000

result:

ok correct

Test #35:

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

input:

3 3
6.0001

output:

4
0.0000000 0.0000000
3.0000000 0.0000000
2.9999000 3.0000000
3.0000000 3.0000000

result:

ok correct

Test #36:

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

input:

4 4
13.999998

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
4.0000000 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #37:

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

input:

4 4
14.0

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
4.0000000 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #38:

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

input:

4 4
14.000002

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
3.9999900 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #39:

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

input:

4 4
15.123104

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
1.0579862 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #40:

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

input:

4 4
15.123106

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
1.0579832 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #41:

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

input:

4 4
15.123108

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
1.0579802 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #42:

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

input:

4 4
14.593385

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
2.0274837 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #43:

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

input:

4 4
14.593387

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
2.0274792 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #44:

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

input:

4 4
14.593389

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
2.0274746 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #45:

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

input:

2 2
4.0

output:

3
0.0000000 0.0000000
0.0000000 2.0000000
2.0000000 2.0000000

result:

ok correct

Test #46:

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

input:

3 3
5.0

output:

3
0.0000000 0.0000000
1.2500000 3.0000000
3.0000000 3.0000000

result:

ok correct

Test #47:

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

input:

4 4
15.123

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
1.0581420 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #48:

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

input:

4 4
14.1

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
3.5409091 4.0000000
4.0000000 4.0000000

result:

ok correct

Test #49:

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

input:

3 3
9.0

output:

4
0.0000000 0.0000000
3.0000000 0.0000000
0.7500000 3.0000000
3.0000000 3.0000000

result:

ok correct

Test #50:

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

input:

4 4
16.0

output:

6
0.0000000 0.0000000
4.0000000 0.0000000
4.0000000 1.0000000
0.0000000 1.0000000
0.0000000 4.0000000
4.0000000 4.0000000

result:

ok correct