Common BoardShow all threads Hide all threads Show all messages Hide all messages | Can anyone explain to me the input ? | ACSpeed | 1878. Rubinchik's Cube | 17 Mar 2024 22:20 | 2 | I don't understand how to translate them to the initial state . Tks This is 4 layered Rubics Cube. These layers are situated behind each other (perpendicularly). You can think them as 4 Cards placed behind each other. Also, each layer is transparent. So, color on the second, third or fourth layer can be seen through the first layer. Top View is watching the cube from the first layer. As all the layers are transparent, so we can see the colors of each layer behind it from the first layer. So, from the TOP VIEW you will see a complete cube combining each layer's colors. In the description, the first picture is the 4 layers of the cube. Can you place them behind each other? What will you see if you observe them from the first layer and considering them as transparent? If you see them like below, then bingo you get the idea!! YRYB RRYY GGBB RGBG Here, the first Y and the last B color of the first row are coming from the 4th layer if you see. And so on for the rests. In the given input, let say the color code is like below, 1 - Red 2 - Yellow 3 - Blue 4 - Green. So, the input basically says that what you will see all the layers from the front of the first layer. If you replaced the number with the color, then you will get the exact same cube that is given in the description. (We have already built it above!!) | Idea | InstouT94 | 2166. Two Roads | 16 Mar 2024 20:49 | 1 | Idea InstouT94 16 Mar 2024 20:49 I haven't coded my idea yet, but it looks plausible. We can use the idea of binsearch by answer. For a fixed cost x, we need to check that all intersection points are inside a square with center (0;0) and side length x*sqrt(2), rotated at an angle of 45 degrees. That is, there are no points of intersection of lines outside the square. Let us cut out the area of intersection with the square for each straight line, then each straight line will be divided into no more than two parts. Then we apply the idea of solving problem 1469. And the complexity will be O(log(max_answer)*n*log(n)). | HINT | Dhaval Rathod | 1742. Team building | 15 Mar 2024 22:33 | 2 | HINT Dhaval Rathod 26 Feb 2022 23:07 first make a SCC , u will get max iterate through scc graph root nodes and in dfs the node size is great than 2 increment answer u will get min is great than 2 no, great than 1! I got AC using it | WA8 | Kruppov07 | 1014. Product of Digits | 15 Mar 2024 16:12 | 2 | WA8 Kruppov07 14 Jun 2020 16:47 150 : 556 Edited by author 14.06.2020 17:05 Re: WA8 Dmitry Zhukov 15 Mar 2024 16:12 There is another interesting test case that might be a cause of WA8. Try 12, and the right answer should be 26. Edited by author 15.03.2024 16:13 | WA #3 :( | Rafal | 1269. Obscene Words Filter | 15 Mar 2024 14:29 | 8 | Hi. Any ideas what they put inside the test file to #3? У меня этот тест проходит :(, но WA 3... Может кто-нибудь помочь с тестом? I have passed your test,but I still WA#3.Why? Read badwords with spaces, so: 'this is badword' not: this is badword :) changes nothing, still wrong answer Could be space trimming of right side or left side a problem... Hi. Any ideas what they put inside the test file to #3? | wa on 3 | Roman | 2133. Terms of reference | 14 Mar 2024 17:39 | 1 | got WA on 3, why, have any tests? Edited by author 14.03.2024 17:39 | Hint | pocochuk | 1152. False Mirrors | 14 Mar 2024 00:30 | 1 | Hint pocochuk 14 Mar 2024 00:30 Use dp + bitmask. I got AC in 0.015 and 1M Edited by author 14.03.2024 00:30 | Works good for my local, why it returns a wrong result? | satybal | 1910. Titan Ruins: Hidden Entrance | 13 Mar 2024 16:51 | 1 | #include <iostream> using namespace std; int main() { double n, k1, k2, k3, pos = 2, current_pos = 2, oldsum = 0; cin >> n; cin >> k1 >> k2; while (cin >> k3) { double sum = k1 + k2 + k3; if (sum > oldsum) { oldsum = sum; pos = current_pos; } k1 = k2; k2 = k3; ++current_pos; } cout << oldsum << " " << pos; return 0; } | WA #5 | Kropt | 1444. Elephpotamus | 13 Mar 2024 11:13 | 1 | WA #5 Kropt 13 Mar 2024 11:13 | Solved with hashes XD | FaNato4kA_TiMoFeYa | 1590. Bacon’s Cipher | 12 Mar 2024 23:47 | 1 | | Why does it return compilation error? I'm using GCC compilator. | satybal | 1001. Reverse Root | 12 Mar 2024 13:34 | 1 | #include <iostream> #include <vector> #include <cmath> using namespace std; int main() { double number; vector<double> numbers; while (cin >> number) numbers.push_back(number); cout.precision(4); cout.setf(std::ios::fixed); for (auto iter = numbers.rbegin(); iter != numbers.rend(); ++iter) cout << sqrt(*iter) << endl; return 0; } | wa 10 | 👑TIMOFEY👑 | 1401. Gamers | 10 Mar 2024 19:20 | 3 | wa 10 👑TIMOFEY👑 30 Oct 2022 13:33 Re: wa 10 vtalgo24_Zakusov_367223 10 Mar 2024 19:18 wa 10 output for "3 3 2": 1 1 2 2 8 8 6 6 1 5 5 2 8 10 10 6 3 0 5 4 9 9 10 7 3 3 4 4 21 9 7 7 12 12 14 21 21 19 18 18 12 15 14 14 19 19 20 18 11 15 15 13 17 20 20 16 11 11 13 13 17 17 16 16 Re: wa 10 vtalgo24_Zakusov_367223 10 Mar 2024 19:20 no overflow, checked all cases for n \in {1, 2, 3} | Mathematical proof! | Elastoman | 1051. Simple Game on a Grid | 10 Mar 2024 00:38 | 2 | Listen everyone, who wants to prove the algorithm to this problem! See the solution of the problem 3 from IMO34 (International Mathematical Olympiad, year 1993). The rectangle in that problem is n*n (not m*n), but it isn't important. And the case 1*n is clear, I think. The problem statement in the problem set for IMO34 is somewhat better. Definitely worth reading. | Optimal solution | ElPsyCongroo | 1209. 1, 10, 100, 1000... | 9 Mar 2024 14:26 | 15 | Ok, just posting this to help others understand few things here: The sequence is 1101001000100000... If you see the locations of the digit 1, you can observe that it is at location 1,2,4,7...=> ( 1 + 0 ),( 1 + 1 ),( 1 + ( 1 + 2 )),( 1+(1+2+3 )..So, it is 1+sum_of_n_digits. What we have now is below: 1 + n*( n+1 )/2 [ note that n*(n+1)/2 is the sum of first n natural numbers ]. Now, this value should be equal to the input value, say P. 1 + n*(n+1)/2 = p [ I/p P=7 => n should be 3, back track ]. 2 + n^2 + n = 2p n^2 + n = 2(p-1) n^2 + n - 2 (p-1) = 0; This is a quadratic equation in 'n'. The roots of a quadratic equation are ( -b +- sqrt( b^2 - 4ac ) )/2a -1 +- sqrt( 8p-7 ) / 2; But, for our example, if you do some analysis, if the value of 8p-7 is a perfect square, then the value at that position 'p' would be 1. Else the value would be 0. So, check for 8p-7 to be a perfect square. This is the optimal solution. Got mine accepted. BTW, if you face any difficulty at test 3, it means you have to upgrade your ints to doubles. Because 8p-7 can falll over the size of int [atleast in Java]. Thanks, ElPsyCongroo. Thanks for the hint. I tried a very similar algorithm but was still getting WA on Test 3 in Java. I finally switched over to Python, and got AC I tried hard with python but all I got was TLE, when I turn into c++ I got AC. У меня на эту задачу есть Accepted решение на Питоне, 499 мс How ( -b +- sqrt( b^2 - 4ac ) )/2a transforms into -1 +- sqrt( 8p-7 ) / 2 ? I do it like this: the n-th '1'should be here: n(n-1)/2+1.So, we judge whether the input number(x) == (n(n-1)/2+1). it could be transformed to 2*x-2 == n(n-1), and int(sqrt(2*x-2)) must be the number 'n' if 'n' exists! sorry, int(sqrt(2*x-2)) == int(sqrt(n*(n-1))) == int(n-1) if 'n' exists How can i upgrade my ints to double ? Sorry for my ignorance.I'm a newbie... vi apnar analysis deikha chudna hoia gelam, airokom chinta kamne ashe mathai Edited by author 20.07.2018 22:26 Edited by author 20.07.2018 22:26 nice Edited by author 20.07.2018 22:26 My initial approach was slightly different, but at the end, it gave the same result. Here's the sequence -> 1 10 100 1000 10000 100000 ... In that sequence, 1s are located at position -> 1, 2 ,4, 7, 11 , 16, 22 ... Look at the 11th position in the sequence. There are total (1+2+3) zeros and (1 + 1 + 1 +1) ones before the 11th 1. So the position no 11 can be written as the sum: (1+2+3) + 4 x 1 + 1. Take another position as example, say 16. Before the 16th position, there are total (1+2+3+4) zeros, and (1+1+1+1+1) ones. And so 16 can be written as, (1+ 2+3+4) + 5 x 1 + 1. Now if you generalize this observation and formulate it, you'll get : n(n+1)/2 + (n+1) x 1 + 1 = (position no containing 1) After simplification, the equation stands: n^2 + 3n + (4 - 2 x Position No) = 0 So for any INTEGER value of n, you'll get a Position No for 1 . Now think the opposite of this . If the Position No contains 1, then n will must have an Integer value. Otherwise, the Position No will contains 0. Solving that equation, you'll get: n = ( -3 +- sqrt( 9 - 4 x 1 x (4 - 2 x Position No)) ) / 2 For n to be an Integer, the determinant (9 - 4x(4 - 2 x Position No)) or (8 x Position No - 7) must be a square number. This an O(log n), because the sqrt function is O(log n) | Тестов бы добавить... | InstouT94 | 1938. Caribbean Triangle | 8 Mar 2024 21:06 | 1 | Добавьте тесты, где точки пересечения прямых очень далеко, и эти прямые почти параллельны. Моя AC программа не проходит тесты: -1000 -1000 -999 1000 0 -1000 1 999 999 -1000 1000 998 -1000 -1000 -999 1000 998 -1000 999 999 999 -1000 1000 1000 | WA 53 | Sasha Fedorova | 1854. Negotiations with Parthians | 8 Mar 2024 19:45 | 1 | WA 53 Sasha Fedorova 8 Mar 2024 19:45 Thymus gives an error on test 53. What should I do? How do you even check what’s wrong? I enter the number 26584441929064321 and the program returns 26584441929064321, but another person on the forum wrote that this is the correct answer. What's the problem then? Please help Edited by author 08.03.2024 22:12 | Ac Pythoh !!! | eremeev.me.2012@gmail.com | 2142. Magic | 8 Mar 2024 18:56 | 1 | a , b , c = list(map(int , input().split())) A , B , C = list(map(int , input().split())) if a+c >= A: if a >= A: c =c a-=A else: c=A-a a-=A-c if b+c >= B: if b >= B: c =c b-=B else: c=B-b a-=A-c if a + b + c >= C: print('It is a kind of magic') else: print('There are no miracles in life') else: print('There are no miracles in life') else: print('There are no miracles in life') | Ac Pythoh 3.9 | eremeev.me.2012@gmail.com | 1283. Dwarf | 8 Mar 2024 18:55 | 1 | a , b , c = list(map(int , input().split())) y = 0 if a <= b: print(0) exit(0) while True: y+=1 if a - (a / 100 *c) > b: a-= a / 100 *c else: break print(y)
| Я не понимаю что надо сделать? | eremeev.me.2012@gmail.com | 1336. Problem of Ben Betsalel | 8 Mar 2024 18:54 | 1 | Что означает отношения квадрата и куба и что за число n | GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!! | WuLF | 1430. Crime and Punishment | 6 Mar 2024 16:53 | 10 | GIVE ME SOME TEST!!!!!! I STILL HAVE WA#2!!!!!!!!! [code deleted] this right? Edited by moderator 22.02.2006 00:38 var a,b,n,k1,k2:longint; begin readln(a,b,n); while n>=a do begin n:=n-a; k1:=k1+1; end; while n>=b do begin n:=n-b; k2:=k2+1; end; writeln(k1,' ',k2); end. земляк помоги решить 10 задачу или проверь Do you check if N=0?? sorry for doublepost Edited by author 11.02.2006 16:13 Whay it does not work too? (WA#2) var a, b, n: LongInt; x,y,xo,yo,q,w: LongInt; begin Read(a, b, n); x := n div a; xo := n mod a; y := n div b; yo := n mod b; q := x * a + xo div b * b; w := y * b + yo div a * a; If q >= w then WriteLn(x, ' ', xo div b) Else WriteLn(yo div a, ' ', y); end. 47 3 49 ans: 0 16 2 3 7 ans: 2 1 It is not guaranteed that A >= B and 2 test checks this. AFAIK if you will throw error if B > A, then you will get Runtime Error on test 2. Edited by author 06.03.2024 16:54 |
|
|