QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#226302 | #2290. Kinking Cables | obss | WA | 1ms | 3744kb | C++17 | 1.8kb | 2023-10-25 19:49:44 | 2023-10-25 19:49:44 |
Judging History
answer
#include <bits/stdc++.h>
// #define tests
#define int long long
const int N = 1e5 + 10;
using namespace std;
using LL = long long;
#define double long double
double dist(double x1, double y1, double x2, double y2) {
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
void solve() {
double len, n, m;;
cin >> n >> m >> len;
vector<pair<double,double>> ans;
ans.push_back({0, 0});
double x = 0, y = 0;
int now = 1;
while(1) {
if(now){
if(dist(x, y, n, m) <= len && m + (n - x) >= len){
double l = 0, r = m;
for(int i = 0; i < 100; i++){
double mid = (l + r) / 2;
if(mid + dist(x, mid, n ,m) >= len) r = mid;
else l = mid;
}
ans.push_back({x, l});
break;
}
y = m;
}else{
if(n - x <= len && m + dist(x, 0, n, m) >= len){
double l = 0, r = m;
for(int i = 0; i < 100; i++){
double mid = (l + r) / 2;
if(m - mid + dist(x, mid, n ,m) >= len) l = mid;
else r = mid;
}
ans.push_back({x, l});
break;
}
y = 0;
}
ans.push_back({x, y});
x += 1e-8;
ans.push_back({x, y});
len -= m;
len -= 1e-8;
now ^= 1;
}
ans.push_back({n, m});
cout << ans.size() << '\n';
for(auto [x, y] : ans) cout << fixed << setprecision(20) << x << ' ' << y << '\n';
}
signed main() {
cin.tie(0)->ios::sync_with_stdio(0);
cout.tie(0);
int t = 1;
#ifdef tests
cin >> t;
#endif
for(int _ = 1; _ <= t; _ ++) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3744kb
input:
79 78 1980.7712136406
output:
49 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 78.00000000000000000000 0.00000001000000000000 78.00000000000000000000 0.00000001000000000000 0.00000000000000000000 0.00000002000000000000 0.00000000000000000000 0.00000002000000000000 78.00000000000000000000 0.0000000300000000...
result:
wrong answer Output path has non-consecutive points within distance 1 of each other: (0.000000000000,0.000000000000) and (0.000000010000,0.000000000000)lie too close to each other