QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#736443 | #8985. Bikes and Barricades | ucup-team004 | AC ✓ | 1ms | 3956kb | C++23 | 904b | 2024-11-12 11:07:36 | 2024-11-12 11:07:38 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout << std::fixed << std::setprecision(10);
int n;
std::cin >> n;
double ans = INFINITY;
for (int i = 0; i < n; i++) {
int x1, y1, x2, y2;
std::cin >> x1 >> y1 >> x2 >> y2;
if (x1 > x2) {
std::swap(x1, x2);
std::swap(y1, y2);
}
if (x1 < 0 && x2 > 0) {
double y = double(x2 * y1 - x1 * y2) / (x2 - x1);
if (y > 0) {
ans = std::min(ans, y);
}
}
}
if (ans == INFINITY) {
ans = -1;
}
std::cout << ans << "\n";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3848kb
input:
2 -10 7 5 19 -1 -1 8 21
output:
1.4444444444
result:
ok found '1.44444', expected '1.44444', error '0.00000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
2 4 -6 -12 -1 3 5 8 8
output:
-1.0000000000
result:
ok found '-1.00000', expected '-1.00000', error '-0.00000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
1 1 -2 1 3
output:
-1.0000000000
result:
ok found '-1.00000', expected '-1.00000', error '-0.00000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
1 10 19 -20 19
output:
19.0000000000
result:
ok found '19.00000', expected '19.00000', error '0.00000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
1000 2 -30 46 25 59 15 78 -78 49 -74 9 35 -45 -34 55 -18 -81 -66 -79 -85 63 -9 99 27 64 94 29 -29 -40 -41 -39 -33 -92 0 -83 -80 -100 64 -2 68 97 -93 57 -31 87 99 -44 -91 -20 -50 68 24 73 -78 37 96 -57 -38 28 -82 -83 46 -66 -8 11 -18 21 72 -82 -7 -11 9 26 -62 45 45 31 13 24 33 35 11 98 -42 57 -23 69 ...
output:
-1.0000000000
result:
ok found '-1.00000', expected '-1.00000', error '-0.00000'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
1000 36 -21 1 -27 16 -90 -22 -36 54 -69 58 -52 62 15 91 -90 -50 -91 -74 -7 75 -68 -18 -50 -50 67 -72 -58 39 -18 -67 -70 48 -67 -88 73 45 89 67 28 -60 -36 75 21 -83 -20 97 -14 -87 -91 -4 11 -45 -48 -21 -8 -32 25 -45 -78 -91 90 -47 -1 -68 -61 6 -84 -27 17 -58 9 46 -76 -16 -24 74 48 91 87 45 -66 -67 21...
output:
-1.0000000000
result:
ok found '-1.00000', expected '-1.00000', error '-0.00000'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
1000 -67 13 28 -24 -50 -93 -5 44 35 -27 -14 0 39 -8 -100 -19 -25 -86 47 3 -38 29 -43 50 60 -44 96 -61 13 79 73 -28 44 29 8 52 60 -51 3 5 -75 85 4 -87 91 8 32 -38 19 -63 52 -81 -56 -85 57 49 19 49 28 29 -38 -87 50 22 -34 -11 2 -46 96 -9 42 -26 -80 85 -12 96 60 85 54 54 81 -99 35 -39 -80 -27 -15 59 -1...
output:
-1.0000000000
result:
ok found '-1.00000', expected '-1.00000', error '-0.00000'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
1000 -96 67 9 -80 -97 -50 16 -46 -7 -77 -73 18 -19 -33 84 -18 15 -65 46 32 -32 85 -87 -53 -99 -84 -73 -48 34 -92 12 6 94 51 -10 -32 43 0 -18 -60 68 -69 -42 18 -42 22 67 -89 -24 41 -4 -11 -21 -71 37 -3 -12 97 -9 59 -10 -28 -70 4 -70 9 -36 26 -80 -35 97 -2 -77 -49 -9 -82 13 -41 -34 93 9 -80 53 71 12 -...
output:
-1.0000000000
result:
ok found '-1.00000', expected '-1.00000', error '-0.00000'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
1000 -92 -84 -38 88 -13 -72 -25 -82 48 49 -30 -69 7 -95 21 -91 79 72 94 65 10 94 4 -37 -69 -81 93 -65 23 54 63 60 34 89 43 78 -100 81 -15 0 47 -71 -91 85 -87 39 41 -30 -57 -57 63 37 -58 13 -98 -10 -8 82 -87 -89 47 -70 92 -10 53 -69 80 -60 12 57 74 39 -99 -61 87 -9 -43 19 -59 -60 99 -11 86 -61 24 -30...
output:
-1.0000000000
result:
ok found '-1.00000', expected '-1.00000', error '-0.00000'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3956kb
input:
1000 -52 47 -45 -81 -38 -73 -58 -100 68 -35 8 36 -86 53 22 76 30 -71 -44 -52 31 -95 64 -5 58 -47 37 38 -40 -29 -57 76 -56 -40 84 93 -37 26 16 -15 -18 34 -45 -44 -38 -19 -58 -25 55 41 -87 -97 80 -55 23 11 -75 -12 31 -47 51 36 -19 -7 40 59 7 -85 83 -59 65 -1 -86 -85 -26 -87 79 83 32 -23 79 68 -85 54 -...
output:
0.3488372093
result:
ok found '0.34884', expected '0.34884', error '0.00000'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3772kb
input:
1000 55 57 -86 -37 83 81 2 10 4 15 26 94 -75 13 58 -76 -61 15 89 65 34 -31 -78 4 74 -50 -3 75 -100 -54 -21 -20 32 29 -42 -63 77 8 -65 -65 -11 -59 -93 43 -12 -49 -54 62 -61 11 17 -96 31 5 84 49 -59 -98 71 -96 3 -30 -42 -49 74 8 -78 91 36 55 -26 36 80 52 25 10 86 13 23 81 -3 77 77 27 -32 60 61 -51 -89...
output:
0.3894736842
result:
ok found '0.38947', expected '0.38947', error '0.00000'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
1000 -8 -32 85 53 -43 -33 -56 -29 53 21 29 -73 -82 68 -81 -44 86 -25 23 5 18 -97 -69 -35 52 79 -44 99 76 76 5 22 -17 37 25 -48 89 -59 -44 -63 -90 71 -64 46 64 -88 -57 -97 -66 -48 46 21 -61 83 94 -65 -16 -71 78 81 -55 71 38 89 -61 -89 -37 -8 32 -18 69 -65 -98 -26 11 -50 53 -92 -77 47 46 51 -87 0 35 -...
output:
0.1654135338
result:
ok found '0.16541', expected '0.16541', error '0.00000'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
1000 24 -71 -17 0 -32 15 68 95 74 -49 46 8 84 83 83 31 -52 44 77 -92 -29 -17 -93 -44 79 9 -34 41 25 61 73 28 22 44 47 -94 8 81 -70 10 93 -6 76 41 76 73 -31 -50 31 -51 68 -60 -77 5 6 82 36 -17 83 -36 -24 -2 -58 85 9 -76 -89 70 -2 -85 -26 -88 -65 -9 88 98 -84 24 58 7 -47 -43 -23 54 -85 24 -83 -4 12 -9...
output:
0.5000000000
result:
ok found '0.50000', expected '0.50000', error '0.00000'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
1000 -18 1 11 77 -80 -53 -22 95 16 -3 -39 78 87 -85 54 -6 -55 13 -85 -38 82 -85 -5 -37 -36 -46 88 10 19 10 75 -60 48 27 -67 -37 -64 -61 78 -40 70 61 91 19 -43 51 86 52 -38 1 76 -41 23 67 -32 -94 39 -65 67 -84 -69 87 -37 6 -45 74 -98 60 27 -17 51 -9 -63 85 -53 -34 74 25 11 -81 96 -36 -58 -11 -27 -95 ...
output:
0.2869565217
result:
ok found '0.28696', expected '0.28696', error '0.00000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
10 -28 97 74 97 47 100 76 95 63 99 84 98 -34 98 11 99 -48 93 16 91 54 100 85 91 -80 97 27 95 -90 94 82 96 66 100 -74 91 -18 92 37 100
output:
91.5000000000
result:
ok found '91.50000', expected '91.50000', error '0.00000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
10 57 94 75 100 15 95 26 96 34 98 -60 97 -37 99 -92 99 2 92 -63 98 22 91 -73 97 -83 91 -90 94 -19 90 -12 100 -26 97 -23 91 99 90 -38 95
output:
92.1846153846
result:
ok found '92.18462', expected '92.18462', error '0.00000'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
10 11 97 -85 94 53 95 -18 93 63 95 31 99 71 100 -37 94 -28 92 -68 100 71 92 -97 95 97 96 72 94 34 97 -75 91 27 91 92 96 -39 99 17 100
output:
93.2678571429
result:
ok found '93.26786', expected '93.26786', error '0.00000'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
10 68 93 -37 90 -43 96 29 99 -75 91 19 90 87 93 -11 92 -12 100 90 98 58 93 25 97 45 96 -94 92 -18 100 -4 98 -98 93 -37 94 92 94 -54 90
output:
90.2021276596
result:
ok found '90.20213', expected '90.20213', error '0.00000'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
10 -100 96 25 91 -91 94 -36 92 -17 94 52 100 4 97 -68 91 59 96 -41 98 -49 90 -4 94 91 97 -63 94 -84 98 24 94 41 100 -41 98 6 100 -30 93
output:
92.0000000000
result:
ok found '92.00000', expected '92.00000', error '0.00000'