Common BoardI could solve it using trivial bruteforce. But I get TL, using more clever and probably expected solution. I used this: https://e-maxx.ru/algo/discrete_root (Read only first section, we don't need anything else). The slowest part here is Discrete Logarithm, which I calculate in \sqrt{n} * log_from_map. My program stuck at WA-17 for several times and I don't know the reason why. Can anyone give me some challenging test cases? Update: accepted now. Key point is to run unit test for the integral division function that I wrote. Both self-written complex division and std::complex<long double> division can be used to get approximate value of the quotient. The more - the better! 'cause I have no idea what I'm doing wrong :\ 50 49 8.4 5.5 //1 50 49 8.4 5 //25 50 49 8.4 4 //28 50 49 8.4 2.0 //37 50 49 8.4 0.2 //48 The answer of second test case is 1, not 25. My ac programm gives 1 for second and 25 for third test #include <iostream> using namespace std; int main() { int leavingCars, minutes; int carPerMinute[100]; int totalCars = 0;
cin >> leavingCars >> minutes; int carsLeavingPerMinute = leavingCars * minutes;
for(int index = 1; index <= minutes; ++index) { cin >> carPerMinute[index]; totalCars += carPerMinute[index]; }
cout << totalCars - carsLeavingPerMinute;
return 0; } Are you going to add javascript (especially nodejs) support for this online judge | Планируется ли добавить на сайт поддержку javascript или nodejs? not 21 passes test: using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { class Program { static void Main() { var f = Console.In.ReadToEnd(); f = f.ToLower(); var b = f.ToCharArray(); string c = ""; c += b[0].ToString().ToUpper(); for (var i = 1; i < b.Length - 3; i++) { if ((i + 1 != b.Length && (b[i] == '!' || b[i] == '?' || b[i] == '.'||b[i] == '-') && (b[i+3] != '-'&&b[i + 1] != '!' && b[i + 1] != '?' && b[i + 1] != '.')))
{ c += b[i]; i++; while (b[i] == ' ' || b[i] == '\t' || b[i] == '\r' || b[i] == '\n') { c += b[i]; if (i + 1 != b.Length) i++; else break; } c += b[i].ToString().ToUpper(); } else c += b[i]; } Console.WriteLine(c); } } } not 4 passes test: using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { class Program { static void Main() { var f = Console.In.ReadToEnd(); f = f.ToLower(); var b = f.ToCharArray(); string c = ""; for (var i = 1; i < b.Length - 1; i++) { if (b[i - 1] == '-') i--; if ((i + 1 != b.Length && i + 2 != b.Length && i + 3 != b.Length && (b[i] == '!' || b[i] == '?' || b[i] == '.' || b[i] == '-') && (b[i + 3] != '-' && b[i + 1] != '!' && b[i + 1] != '?' && b[i + 1] != '.'))) {
c += b[i]; i++; while (b[i] == ' ' || b[i] == '\t' || b[i] == '\r' || b[i] == '\n') { c += b[i]; if (i + 1 != b.Length) i++; else break; } c += b[i].ToString().ToUpper(); } else { if (i == 1) c += b[i - 1].ToString().ToUpper(); c += b[i]; } } Console.WriteLine(c); } } } Edited by author 03.01.2015 21:08 - IS IT CORRECT? - YES, IT IS. - Is it correct? - Yes, it is. Мне этот пример помог 21 тест пройти If you have this problem - remember that a sentence is ended only with "!?." Endline is not an end of a sentence Here are jokes with statuses, such as we go in order along the vertices and if we get to a vertex that we haven't been to, then we start going in a cycle from this vertex, setting the status of this cycle, if we get to the same status, then this is a cycle, if we get to a vertex with a lower status, then everything is fine and we stop the cycle, and if the vertex has no status, then we just opened a new vertex and it turns out that the algorithm is linear I've been trying to solve this problem for so long, I've had a lot of errors, more than 150 lines of clean code, I've tried to do a little dirty debug, but I think it's not fair. I got wa11, I didn't know what it was, it just turns out I forgot to sort the array correctly, it was in the second part when I'm looking for vertical stripes that I forgot to sort and got wa 11, while I was looking for it, I did a lot of tests and can show them to you. I can give advice on what to count, count all vertical rectangles 1*l where l>=2 and horizontal rectangles l*1 where l>=2, add them up and add all single cells. tests: 4 4 10 1 2 1 3 2 1 2 4 3 2 3 3 4 1 4 2 4 3 4 4 5
4 4 5 1 2 2 1 2 4 3 3 4 2 9 4 4 8 2 1 2 2 2 3 2 4 3 1 3 4 4 2 4 3 4 4 4 8 1 2 1 3 2 1 2 3 3 1 3 3 3 4 4 2 5 4 4 4 2 2 2 3 3 2 3 3 4 4 4 3 2 3 3 2 3 3 6 5 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2 4 4 4 6 4 14 5 1 4 1 1 3 1 4 1 5 1 2 WRONG!!! on this test i have eror, right ans is 1 good luck, don't give up it's not such a difficult problem! Каким образом во втором тесте(примере) получаем 2 полосы??? если даже когда вручную нарисовав таблицу 1х5, получаем максимум 1 полоску????каким образом вторая получается??? п.с.или белая полоса может состоять из одного дня???? How in the second test(example) does get 2 bars??? if even when by hand drawing a table 1x5, get a 1 strip maksimum???? how does the second turn out??? p.s. or can a white bar consist of one day???? Kakim obrazom vo vtorom teste(primere) poluchaem 2 polosy??? esli dazhe kogda vruchnuju narisovav tablicu 1h5, poluchaem maksimum 1 polosku????kakim obrazom vtoraja poluchaetsja??? p.s.ili belaja polosa mozhet sostojat' iz odnogo dnja???? Без комментариев No comments Bez kommentariev Исправьте тесты! Неправильные примеры. It is all right. Even 1 square is the bar (if it not contains in other bars). So it must be added. ti cho otvet 0, poloska dlinoi odin ne mojet bit, a test is inkarekt My program stucked at WA-25 for several times and I don't know the reason why. One thing that confuses me is that I don't know how to deal with the following sentences in problem statement: "You should consider a rotation to map a key point A to a key point B if A is mapped to a point within 10−6 units distance from the point B. Rotations having the same mapping should be considered as the same rotation." I think the second sentence is redundant since a rotation is uniquely determined by its images on two different non diametral points. I don't know how to implement a function such that, given the images q_i of each point p_i, determine if any rotation f exists such that dist(f(p_i), q_i)<1e-6. I had TL 5 because I did not add vertices to the BFS queue properly (sometimes I put the same vertex multiple times and then process in many times). You may try this test: [test cut, too big] Edited by moderator 06.09.2022 03:04 Answer is: 5 0.3836 1 12223 2 75002 3 Firstly, I pre-calculate the index which carries 1, and store them on the map. then I take input and check the map if the map stored 1 for this input, then I printed 1, otherwise 0. what is wrong here? I walked through all topics in discussion, grabbed every test, but still got WA7. I had several mistakes in my solution. First of all, in some versions I forgot to make fixed format of output and forgot to cast my answer to integer type, therefore the solution printed the answer in scientific notation. Test: 25 7217 6651 7358 2764 7034 5638 2431 6831 6550 2019 2334 1524 3375 4802 5960 4579 7078 1798 3176 7335 5872 3950 179 7351 9800 3982 2080 897 9345 2389 6470 6556 8420 9316 1671 7557 922 2613 9464 6735 1865 8925 6701 3365 6519 6665 9458 1535 8792 4383 Answer: 1495422 In some solutions there were rounding issues, I rounded down while should have rounded up. Still I disagree that sometimes one should use floor(ans) instead of int(round(ans)), the latter always works fine in this problem. Test: 3 4826 9656 137 7424 8340 2686 Answer: 22472 In some attempts I accidentally used = instead of ==, this test detected this perfectly. Test: 4 0 0 2 0 2 2 0 2 Answer: 14 Edited by author 01.09.2022 22:29 ITS REALLY HARD I WORK SO HARD FOR THIS PROBLEM TO DO ITS REALLY FAST, U HAVE 1MB MEMORY input THIS IS ABOUT 600-700k symbols, U NEED TO DO ITS Very VERY VERY VERYVERY VERy fAST AND THIS VERYV VEryV eVEYR Very HARD U NEED TO READ THIS NEVER NEVER NEVER USE CIN USE c=getchar() where c - char. And IF U WANT TO STOP INPUT JUST int WHILE in the conditions of the while loop, put restrictions on the symbol, that is, there are all charms from A to Z and something else. AND THEN YOU NEED A REALLY FAST ALGORITHM I rewrote mine six times, I can't understand it myself, it's very difficult, I only remember that char is int, and int is a deadline, and diffirintly THE ALGORITHM is SLOW Please remember that input can contain numbers with more than one digit. My WA was due to this, and I don't think anybody will be this silly. But still posting! :) Edited by author 29.08.2022 21:23 Edited by author 29.08.2022 21:23 delete iostream and using namespace std. all cin cout replace on scanf and pritf write in start of code: #define CRT_SECURE_NO_WARNINGS and #include<cstdio> and behind your vectors,pair and queue write std:: do vector WITHOUT ANY INTS, ALL BOOL DONT USE PUSH_BACK its really slow, just write size of vector Example: >std::vector<std::vector<bool>> a(n); >std::vector<bool> b(m); and call with a[i][j] or something else; If you look at other aspects of the task, then EASY BFS String can have size 1000, max size is not 999. |
|