QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#134382 | #2290. Kinking Cables | PetroTarnavskyi# | WA | 2ms | 3760kb | C++17 | 1.5kb | 2023-08-03 18:36:42 | 2023-08-03 18:36:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FILL(a, b) memset(a, b, sizeof(a))
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long double db;
vector<pair<db, db>> ans;
const db eps = 1e-6;
int main()
{
int n, m;
db l;
cin >> n >> m >> l;
db sta = l;
ans.PB(MP(n, m));
while(true){
assert(l >= sqrt(n * n + m * m) - eps);
if(l <= n + m){
db L = 0, R = m;
FOR(t, 0, 300){
db x = (L + R) / 2;
db val = (m - x) + sqrt(x * x + n * n);
if(val > l)
L = x;
else
R = x;
}
ans.PB(MP(n, R));
ans.PB(MP(0, 0));
break;
}
l -= m + 1;
ans.PB(MP(n, 0));
ans.PB(MP(n - 1, 0));
n--;
if(l <= m + sqrt(n * n + m * m)){
db L = 0, R = m;
FOR(t, 0, 300){
db x = (L + R) / 2;
db val = x + sqrt(x * x + n * n);
if(val > l)
R = x;
else
L = x;
}
ans.PB(MP(n, R));
ans.PB(MP(0, 0));
break;
}
ans.PB(MP(n, m));
ans.PB(MP(n - 1, m));
n--;
assert(n >= 0);
}
cout << SZ(ans) << endl;
reverse(ALL(ans));
cout << fixed << setprecision(8);
FOR(i, 0, SZ(ans))
cout << ans[i].F << " " << ans[i].S << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3760kb
input:
79 78 1980.7712136406
output:
97 0.00000000 0.00000000 32.00000000 36.34582069 32.00000000 0.00000000 33.00000000 0.00000000 33.00000000 78.00000000 34.00000000 78.00000000 34.00000000 0.00000000 35.00000000 0.00000000 35.00000000 78.00000000 36.00000000 78.00000000 36.00000000 0.00000000 37.00000000 0.00000000 37.00000000 78.00...
result:
wrong answer Output path has length 3797.771213632, should have length 1980.771213641