|
|
Общий форумusing System; namespace _1876_Csharp { class Program { static void Main(string[] args) { int a= Convert.ToInt32(Console.ReadLine()), b = Convert.ToInt32(Console.ReadLine()); int c = Math.Max(2 * a + 39, 2 * b + 40); Console.WriteLine(c); } } } There are two variants: 1) You forgot to sort the array 2) You forgot that after sorting the array, indexes are messing up I've got several times WA 10 and in the forum I couldn't find any test for this test, and finally I found where was the mistake. Try this: (* WTF?!! * ) answer is yes No! It's wrong. The asnwer is NO because the comment isn't closed. The comment should end by '*)', not '*\n)' Edited by author 04.10.2021 02:11 Let a bit change first test 4 5 1 4 10 10 90 20 1 2 5 5 50 10 --> 5 changed to 10 2 4 15 10 50 5 2 3 1 14 10 1 3 4 15 1 50 1 Is 2-->4 flying guaranteed arrive to Las Vegas? Answer -> ? Try this if you have WA18: 10 7 3 0 5 9 2 3 7 3 1 4 4 The answer is: 12 1 8 + 1 8 + 4 1 + 9 6 + 2 9 - 2 9 - 3 10 - 6 3 - 6 3 - 6 3 - 6 3 - 6 3 - Earlier this problem has got a strict result about a lot of realizations - about two years ago I have a submit which got a MLE 10 (7603331), but now this code on same compiler (VS C++ 2017) have only 252 KB! But on G++ - MLE 1. Similarly - my older AC code now have less memory. How it works? Why it has got such difference in memory after two years and between compilers? Changing virtual machine get this strange result? I think there is a bug with measuring memory used This text helped me:) 1 2 1 4 1 3 2 4 2 3 3 4 3 5 5 6 5 8 8 7 7 6 6 8 Check my submission #9470674 for problem 1306. It says 184 KB memory used. I am allocating vector of 125000 int32 values, at least it should be 500 KB. Very few solutions go in range 500-600KB, and I don't see anyone under 500 for C/C++/Pascal. Something is wrong. Edited by author 27.09.2021 02:20 Edited by author 29.09.2021 19:50 Fill n - k + 1 elements with zeros 1. There's a «pair stat» thing... then, there are 4 quest descriptions above. In those formulas, it's not quite clear whether i should use pair stat or individual stat in each case. For instance, «The time needed to perform investigation by an agent with intelligence i is mint/i where mint is the minimal time required to perform this investigation. After completing the investigation the agent gets (1−x)·i/mint experience, where x is agent's experience before the operation. His intelligence increases by (1−i)·i/mint.» — should i use pair int or individual int in each case? I assumed that for mint/i we use group i to make it faster, and for latter two formulas we use individual exp and int (calculation as if everyone completed the quest by himself...) Of course, judging by accuracy stat, which being used in a group makes it only worse (or at least not better), it's very likely i should also use other similar stats as group stats, but... 2. I'm also wondering about quest talk (negotiations), should i use group stats there at all? For kill, there's «The number of monster kinds (at most 50), after that for each monster kind: the minimal experience needed to kill a monster of this kind, minimal intelligence needed to kill a monster of this kind»; For investigation, there's a «minimal intelligence required to perform the investigation» given; But for negotiations, there's given «the minimal experience >>>of an agent<<< that can take part in negotiations» — does that mean that i should use group stats in 2 and 3, but not in 4? 3. For negotiations quest, if there's an agent with good exp (0.9) but bad wlk and drv (0.01 each) + agent with 0.99 drv and a car, to make it fast; but with slightly worse exp of 0.85; and the minimal exp required for negotiations is 0.8. So: if for question 2 above, i shouldn't use group stats in here, but only individual ones — then, are they both forced to take part in discussions, resulting in a time of 0.85exp usage; or 0.85exp guy can safely ignore the negotiations part? And if he does that, will he receive exp too in the end? UPD: 4. Agent A (0.9drv) and Agent B (0.8drv) go together in a car. A levels up driving after the quest. Does B too? 4.1. If he doesn't, then if A with 0.9drv and B with 0.9drv go to the quest (say, they're obliged to, because they have 0.5exp both, and monster requires 0.51, which would be met for a pair exp), then which one receives driving exp? UPD: 5. Should stats be rounded to 2 digits after modifying? So many questions, so little answers... Edited by author 03.06.2016 04:02 5. Should stats be rounded to 2 digits after modifying? I bruteforced for all integers in range(-2000,2000) and got the best approximation for value a1. Then I brutforced for all doubles in range(a1-100;a1+100) and got AC Try this: 1 5 1.00 answer: 0.20 try longdouble XD I used longdouble instead of double and got AC My sulution a has n^2 * 2 ^ n and get TL accepted solution supposed to be O(n * 2^n), right? You can manage with a blunt force solution, but you have to make it at least slightly optimized. I got AC in 1.8s by recursively searching for available combos of 3, and if on another step there were none, i searched for positions to destroy at least one. 1000 1000 1000 50 50 1000 1000 1000 1 1 1 1000 1000 1000 50 50 in this case you need to shot combos of 2 (50 50) earlier then combos of 3 (1 1 1) (when combos (1000 1000 1000) are shoted) I have some tests for my program: N K Result 3 2 4 4 3 5 4 2 8 5 2 12 5 3 8 5 4 6 6 2 18 6 3 12 6 4 8 6 5 7 7 2 24 7 3 16 7 4 12 7 5 9 7 6 8 8 2 32 8 3 21 8 4 16 8 5 12 Check my answers, please! Thank you. > I have some tests for my program: > N K Result > 3 2 4 > 4 3 5 > 4 2 8 > 5 2 12 > 5 3 8 > 5 4 6 > 6 2 18 > 6 3 12 > 6 4 8 > 6 5 7 > 7 2 24 > 7 3 16 > 7 4 12 > 7 5 9 > 7 6 8 > 8 2 32 > 8 3 21 > 8 4 16 > 8 5 12 > Check my answers, please! > Thank you. Some you tests are wrong... For example: 8 5 -> 11, 7 4 ->10, etc... Edited by author 15.08.2008 16:19 Edited by author 09.12.2012 18:28 Edited by author 09.12.2012 18:28 for 8 5 correct answer is 12 1 1 1 2 2 2 2 2 1 1 1 2 2 2 2 2 1 1 1 2 2 2 2 2 1 1 1 x x 3 3 3 1 1 1 x x 3 3 3 4 4 4 4 4 3 3 3 4 4 4 4 4 3 3 3 4 4 4 4 4 3 3 3 Thanks for tests! It helped me got AC. Take care in the cases of multiple lines. I was thinking it wasn't possible and it was giving me WA5. When I took care of it I got AC. Why I have WA? #include <iostream> #include <cmath> using namespace std; int main() { double const pi = 3.14159265358979323846; double a; double r; cin >> a >> r; long double s = pi * r * r; if (r <= a / 2) { cout << roundl(s * 1000) / 1000; } else if (r >= ((a / 2) * sqrt(2))) { cout << (int) (a * a) << endl; } else { double cosx; cosx = (a / 2) / r; double rad; rad = acos(cosx) * 2; double segm = (r * r / 2) * (rad - sin(rad)); s = s - 4 * segm; cout << round(s * 1000) / 1000 << endl; } return 0; } Solved with Z-function in 17 rows of code (if don't count 10 rows for Z-function) |
|
|