|
|
The 7th test case is: 2 5 1 And my program outputs 348. I've tried to brute-force, and I got the same result. Did I misunderstand the problem? What should be the output for this test case? Ok, the answer is 780, but I don't know why. Ok, I'm stupid. Here's a function that checks if a matrix respects the Lunar Condition. bool lunar_check() { for(int i = 0; i != N-1;++i) { int count = 0; for(int j = 0; j != M;++j) { count += (matrix[j][i]==0&&matrix[j][i+1]==1); } if(count>K) return false; } return true; } I hope that nobody else's have problems reading the statement. ;-; Input: 1 40 1 Output: 1099511627776 I've got WA on 4th test. Can anyone tell me some tests to check my solution? You have to use BigInteger, you can't simply use Long Long bc the answer can go up to 2^(1600) ...for test 40 40 40? My is 32460430015431999968619493682032835511850959272235390105491169601 Too small... Obviously, the answer is 2^1600 = (2^10)^160 ~ (10^3)^160 ~ 10^480 Right answer is 44462416477094044... Edited by author 05.10.2016 16:36 Very interesting reccurences Should solve for beggining for (N,M<=6) in int __int64 and translate after to long arithmetics(I used 500 digits) after 400 problem should take in common rather complicated solutions Что за 999 в условии? М - это количество строк или столбцов? В записи A[j][i], что идет сначала - строка или столбец? "Do not use language other, than English in webboard." 1)Fixed 2,3) No comments |
|
|