QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226302#2290. Kinking CablesobssWA 1ms3744kbC++171.8kb2023-10-25 19:49:442023-10-25 19:49:44

Judging History

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

  • [2023-10-25 19:49:44]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3744kb
  • [2023-10-25 19:49:44]
  • 提交

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();
}

详细

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