QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#19600 | #2290. Kinking Cables | JohnAlfnov | WA | 3ms | 3740kb | C++20 | 945b | 2022-02-06 12:50:20 | 2022-05-06 06:16:37 |
Judging History
answer
#include<bits/stdc++.h>
#define eps 1e-6
using namespace std;
int main(){
int n,m;
double l;
cin>>n>>m>>l;
vector<pair<double,double>>g;
if(l<sqrt(1.0*n*n+1.0*m*m)+eps){
g.emplace_back(make_pair(0,0));
g.emplace_back(make_pair(n,m));
}else if(l<n+m){
double a=(1.0*n*n+1.0*m*m-1.0*l*l)/(2.0*n-2.0*l);
g.emplace_back(make_pair(0,0));
g.emplace_back(make_pair(a,0));
g.emplace_back(make_pair(n,m));
}else{
g.emplace_back(make_pair(0,0));
g.emplace_back(make_pair(n,0));
l-=n;
for(int i=0;i<m;){
if(l<m+eps){
g.emplace_back(make_pair(n,m));
break;
}
double di=min(n+0.0,(l-m)/2);
l-=2*di+2;
g.emplace_back(make_pair(n,i+1));
g.emplace_back(make_pair(n-di,i+1));
g.emplace_back(make_pair(n-di,i+2));
g.emplace_back(make_pair(n,i+2));
i+=2;
}
}
printf("%d\n",(signed)g.size());
for(auto pi:g)printf("%.6f %.6f\n",pi.first,pi.second);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 3740kb
input:
79 78 1980.7712136406
output:
51 0.000000 0.000000 79.000000 0.000000 79.000000 1.000000 0.000000 1.000000 0.000000 2.000000 79.000000 2.000000 79.000000 3.000000 0.000000 3.000000 0.000000 4.000000 79.000000 4.000000 79.000000 5.000000 0.000000 5.000000 0.000000 6.000000 79.000000 6.000000 79.000000 7.000000 0.000000 7.000000 0...
result:
wrong answer Output path has length 1958.771214000, should have length 1980.771213641