Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Why I have WA#10? | Марьин | 1489. Точки на параллелепипеде | 6 окт 2024 21:48 | 2 |
Why I have WA#10? I can't think test to get wrong answer. PLS help me Next my code: #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { double a, b, c, x, y, x2, y2; double X, Y, Z, X2, Y2, Z2; double result = 0; bool bflag = true; cin >> a >> b >> c; for (int i=0; i < 2; i++) { cin >> x >> y; if (x < c) { X = 0; Y = y - b - c; Z = x; } else if (x > c + a) { X = a; Y = y - b - c; Z = 2 * c + a - x; } else { if (y <= b) { X = x - c; Y = b - y; Z = 0; } else if (y <= b + c) { X = x - c; Y = 0; Z = y - b; } else if (y <= b) { X = x - c; Y = y - b - c; Z = c; } else { X = x - c; Y = b; Z = 2 * b + 2 * c - y; } } if (bflag) { x2 = x; y2 = y; X2 = X; Y2 = Y; Z2 = Z; bflag = false; } } //cout << X << ' ' << Y << ' ' << Z << ' ' << X2 << ' ' << Y2 << ' ' << Z2; это типа отладка X2 -= X; Y2 -= Y; Z2 -= Z; result = sqrt(X2 * X2 + Y2 * Y2 + Z2 * Z2); if (result < 1.E-8) cout << fixed << setprecision(6) << 0; else cout << fixed << setprecision(6) << result; return 0; } Sorry, I'm find mistake now, it's a one wrong if in my code, thk all to find this |
Hint for WA#7 | Keworker `~ | 1489. Точки на параллелепипеде | 3 июл 2024 13:57 | 1 |
I had WA#7 and it was passed (and problem become accepted) when I fixed the case where the Y-cord of one of points was equal to B + C. So test 7 is something like that: A B C X1 B + C X2 Y2 Good luck! |
WA on test 25 | Casio991ms | 1489. Точки на параллелепипеде | 18 мар 2021 22:31 | 1 |
Getting WA on test 25, any test case? |
Те у кого WA 10 все сюда | Toshpulatov (MSU Tashkent) | 1489. Точки на параллелепипеде | 13 фев 2020 20:03 | 1 |
2 2 2 2.01 4.01 3.99 4.01 правильный ответ 1.9800000 у меня было 1.9900000 Дело в том что чтобы не париться с double я умножал сразу на 100 но оказалось что 2.01 * 100 == 200 а не 201. Пришлось вручную переводить две цифры после запятой и решение зашло! |
wa 10 | Michael Glushkov | 1489. Точки на параллелепипеде | 11 ноя 2019 21:39 | 1 |
wa 10 Michael Glushkov 11 ноя 2019 21:39 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _1489 { class Point { public double x; public double y; public double z; static void Main(string[] args) { int A, B, C; string S = Console.ReadLine(); string[] SS = S.Split(); A = Convert.ToInt32(SS[0]); B = Convert.ToInt32(SS[1]); C = Convert.ToInt32(SS[2]); double x1, y1, x2, y2; double[] mas = Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); x1 = Convert.ToDouble(mas[0]); y1 = Convert.ToDouble(mas[1]); double[] mas2 = Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); x2 = Convert.ToDouble(mas2[0]); y2 = Convert.ToDouble(mas2[1]); Point a = new Point();
// A - x B - y C - z // x if (x1 <= C) a.x = 0; else if (x1 <= C + A) a.x = x1 - C; else a.x = A; // y if (y1 <= B) a.y = B - y1; else if (y1 <= B + C) a.y = 0; else if (y1 <= 2 * B + C) a.y = y1 - B - C; else a.y = B; // z if (y1 <= B) a.z = 0; else if (y1 <= B + C && x1 <= C + A && x1 >= C) a.z = y1 - B; else if (x1 <= C && y1 <= 2 * B + C) a.z = x1; else if (x1 >= C + A && y1 <= 2 * B + C) a.z = A + C + C - x1; else if (y1 >= B + C + B) a.z = 2 * (B + C) - y1; else a.z = C;
Point b = new Point();
// x if (x2 <= C) b.x = 0; else if (x2 <= C + A) b.x = x2 - C; else b.x = A; // y if (y2 <= B) b.y = B - y2; else if (y2 <= B + C) b.y = 0; else if (y2 <= 2 * B + C) b.y = y2 - B - C; else b.y = B; // z if (y2 <= B) b.z = 0; else if (y2 <= B + C && x2 <= C + A && x2 >= C) b.z = y2 - B; else if (x2 <= C && y2 <= 2 * B + C) b.z = x2; else if (x2 >= C + A && y2 <= 2 * B + C) b.z = A + C + C - x2; else if (y2 >= B + C + B) b.z = 2 * (B + C) - y2; else b.x = C;
double difx = (a.x - b.x); double dify = (a.y - b.y); double difz = (a.z - b.z); //if (difx * difx + dify * dify + difz * difz > 0) Console.WriteLine((Math.Sqrt(difx * difx + dify * dify + difz * difz))); //else Console.Write(0); } } } |
Why WA#4??? Please give me some tests | Ras Misha [t4ce] | 1489. Точки на параллелепипеде | 10 июл 2018 16:32 | 5 |
[code deleted] Edited by author 07.01.2010 14:37 In 5th constructor (pts[i] = new Point3D(B, C - (x[i] - A - C), y[i] - B - C);) X must be equal to A. I'm very inattentive Thank you, thank you This test helps me to pass test#4 3 3 3 4 7 4 2 Answer: 3.000000000 Lol, it helped indeed. I assigned Z twice instead of assigning Z and Y in the case of a bottom face of the figure. |
I do simple check to what part does the point below. What's wrong? WA#6. Some tricky tests? Thanks (-) | Alexey | 1489. Точки на параллелепипеде | 30 окт 2017 01:20 | 11 |
Edited by author 15.10.2006 11:24 Check each region by x and y, e.g. if (b+c<=y && y<=b+c+b && c <= x && x<=c+a) // bottom region I had some mistakes like If y>=a+b+c ... but must be If y>=b+b+c I have one check per one side. For example If y<=b - the point is on the lowest side (on the picture). If x<=c - the point is on the leftest side. etc. So, it is enough to check, you see, but WA#7. Thanks for help but still need it. ) You need check y > b+b+c and y < b+c.. because when point on the edge .... You can do mistake ... (I was wrong in this) I have AC, so thank U very much! But I still don't understand my mistake. It is guaranted that the point is in the picture, so I can only check one coordinate... Cann't understand... be careful when you do checks like if (x <= a) then ... it can produce WA, becouse if x = a, point can lie on another side Yes, that is true. Thank you. The test that makes the difference is: ------- 2 2 2 0 4 4 0 ------- before this correction the answer was 4.8989794856 (wrong!) but the right answer is 2.8284271247 (verifyed with AC program). This is great test. Thank you! TY, Paul Diac! Edited by author 30.10.2017 01:21 no mes SuperLight 26 июн 2009 19:31 If you use real numbers, you can get situation, when point lies on none of 6 sides. So you should work with epsilon. Or you can use exact arithmetic, just multiply numbers by 100! It means 100 and !, not 100! :) Edited by author 26.06.2009 17:41 |
(1489!) Please, what answer is for this test: | Nickolas | 1489. Точки на параллелепипеде | 30 окт 2017 01:14 | 4 |
346 158 618 955.0 105.0 891.0 93.0 65.1152, isn't it????? Edited by author 21.04.2008 16:38 65.11528238 Should be 65.1153 if you print 4 digits (but the problem requires to print at least 6). |
if you hava wa8! | Ching Tyan | 1489. Точки на параллелепипеде | 3 окт 2014 19:21 | 5 |
I have wa8 when I used float numbers, when I changed it to double I get ac. Never use float at ACM contests :) Re: if you hava wa8! UXMRI: Sergey Baskakov, Raphail Akhmedisheff and Denis Nikonorov 26 июн 2009 17:02 just forget this wrong word 'float' :) right words are 'extended' 'double' :) Great thanks to you! :) Really helpful! thank you very very much!!! |
If you have WA#9. | Ural FU CRUELCATSOLOLO (Kulaev, Orehov, Yankin) | 1489. Точки на параллелепипеде | 4 июл 2014 18:44 | 2 |
Please somebody help me, and give some tests, please! WA#9 is because of integer overflow |
printf precision | []zhi (Bozhin Katsarski) | 1489. Точки на параллелепипеде | 30 дек 2013 02:30 | 2 |
My question is not particularly about this problem, but about printf output with precision 10^-6 or better. In this problem when I use float and output with printf("%.6f", ... ) I get WA8. When I use double and printf("%.6lf", ... ) I get WA1. What is the correct approach please?
I later got AC with this algorithm, it was correct as I had expected. What I did was use double for the points' coordinates and output with ".6f" as if the were float. Why does that work and my other version doesn't? |
Please AC's people come in. | wcwswswws | 1489. Точки на параллелепипеде | 2 авг 2012 23:13 | 4 |
Can you tell me why I am wrong in test 2 if you was wrong in test2 once? I have got WA2, because I had incorrect region checking (I used only x or y coordinate). When I used x and y I got AC. e.g. checking of bottom region is: if (b+c<=y && y<=b+c+b && c <= x && x<=c+a) Check variant, when points situated on one border!!! Olympic Bear, I had same problem and your method rocks! :D Edited by author 02.08.2012 23:28 |
No subject | time-lizk | 1489. Точки на параллелепипеде | 2 сен 2010 12:29 | 2 |
How to control the output precision?What does "to the acuracy of 10-6? Up! Why in task 10^6, but output 10^16 |
WA 13. Any tests? | Programmer | 1489. Точки на параллелепипеде | 20 янв 2010 13:30 | 2 |
Try this test: 4 3 2 8 5 2 3 Right answer is: 4.0000000 |
If you have WA#3 | Smilodon_am | 1489. Точки на параллелепипеде | 20 янв 2010 11:32 | 1 |
I have had WA#3, but when I have tried following test, I pass Test#3, but have WA#13: 4 3 2 2.0 0.0 2.0 10.0 Right answer: 0.0000000 Now I have AC. Edited by author 20.01.2010 13:32 |
I can't understand my mistake (WA 4) | Smusenok Sergiy Andriyovich (kHAI) | 1489. Точки на параллелепипеде | 2 авг 2009 20:38 | 1 |
[code deleted]. now i have WA 13 any tests? Edited by author 19.08.2009 04:56 |
I have WA 2. | Dave-B | 1489. Точки на параллелепипеде | 29 май 2009 17:22 | 1 |
Please, someboby help me and give me some tests! |
WA 10 | AlAnt | 1489. Точки на параллелепипеде | 31 мар 2009 21:49 | 2 |
WA 10 AlAnt 31 окт 2006 11:24 Can somebody say me, what is in test 10? I don't know, why i got WA... Re: WA 10 [SPbSU ITMO] alant 31 мар 2009 21:49 Finally I've got AC. My mistake was, I think, in printing something like "-0.*" when answer is less than epsilon. |
WA#42...What's fault? | Yashar Abbasov | 1489. Точки на параллелепипеде | 3 авг 2008 15:37 | 2 |
Maybe there is a special case that is not mentioned in the problem or I didn't understand... Can you give some tests? I didn't work on any of special cases. There is a good test - points that are close on the surface will be pretty close in 3D space. Otherwise you've flipped something. Also check boundary cases, especially on the edge of the envelope. |
... | Crash_access_violation | 1489. Точки на параллелепипеде | 23 дек 2007 17:46 | 1 |
... Crash_access_violation 23 дек 2007 17:46 Thanks I got AC... Edited by author 27.12.2007 15:33 |