Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This fork should fix the issue
After verification, the C++ test suite is definitely broken. This is an example of input for the medium tests in C++ :
{3,6,3,5,7,3,5,8,6,10,5,7,6,5,7,7,7,3,1,8,3,3,6,1,6,10,8,5,7,2,10,1,8,4,5,6,8,9,5,5,1,10,1,6,4,7,4,2,2,5,9,4,9,6,6,5,5,5,9,1,7,10,3,6,3,8,1,10,8,6,4,8,5,4,6,10,3,9,1,4,3,1,9,2,7,7,8,3,1,6,4,9,5,8,4,9,5,7,8,5,2,3,2,8,8,7,9,10,6,9,5,10,1,4,3,7,10,10,10,2,5,5,1,1,2,6,1,9,2,8,3,5,2,4,2,10,3,10,1,10,10,8,9,1,1,2,9,2,1,8,5,8,4,7,10,6,3,1,6,6,10,8,1,2,1,4,3,5,6,5,4,5,2,5,7,4,6,6,7,8,5,2,7,9,8,7,6,2,9,1,8,10,8,10,3,10,5,5,7,10,2,10,7,3,4,3,9,1,10,5,1,5,6,7,5,6,5,10,9,5,2,8,5,9,7,7,10,2,4,6,3,5,8,9,9,3,4,9,4,5,4,6,1,1,4,5,8,9,6,7,5,7,4,9,7,3,8,7,6,1,4,8,7,3,9,7,6,4,6,1,10,9,6,1,1,9,5,9,9,1,7,4,9,10,4,6,4,1,4,9,1,9,9,7,2,7,4,7,2,1,7,1,9,4,1,9,2,8,9,3,8,5,6,6,7,9,3,10,2,6,9,2,5,7,1,6,5,6,4,6,6,2,6,6,5,9,6,8,6,5,10,5,9,7,2,5,8,5,7,9,2,5,2,8,3,2,3,7,9,8,2,6,9,9,1,3,9,7,3,4,3,4,8,3,1,2,10,8,6,6,8,7,10,9,5,2,3,9,10,1,9,1,7,7,1,9,2,10,7,4,3,9,7,3,4,9,4,3,8,1,8,5,9,9,4,5,2,6,6,1,8,4,3,6,10,3,5,1,4,3,6,9,4,5,1,7,3,6,9,1,8,8,5,6,6,10,1,7,7,6,9,5,1,1,2,10,5,8,3,9,1,8,7,4,4,9,10,7,6,10,7,3,7,3,8,4,3,10,10,9,7,10,5,7,10,7,7,6,6,1,4,6,10,2,1,4,10,2,10,5}
and the correct output (computed with the Python reference solution) is
9189219707931193199459304195173016683771551867906074348090583697662521149392759681823894170077096644424564514318051866413296335691814331382722620500757801464266905719107348148032214941363160214553271053804378298390939293712808946127253452553014633676202571044656910855336273969534459600000
which is far too big for an
unsigned long long
to hold.This comment is hidden because it contains spoiler information about the solution
I'm encountering the same problem. My C++ solution overflows on medium and large tests, but passes all tests when rewritten in Python (so the algorithm it uses is likely correct). The intermediate values it manipulates are smaller than the total result, which would indicate that the expected result for medium and large tests does not fit in 64-bit integers, and that the reference C++ solution either overflows or does modular arithmetic over an unspecified constant
I've merged the descriptions in this fork. Are there any other changes I should make that I missed ?
The solution still needs to be merged with some more recent changes.
It's done
Done. I don't know of an easy way to check this kind of thing in C++, so I used a regex to check if
<regex>
has been included in the solution's code.The location of the solution file is now
/workspace/solution.txt
. Please adjust the path.Do you have a progress with approving?
I would like to add that the method is the general method however this is so bad way of writing a code, it is like a doctor's handwriting, please try to seperate blocks and use spaces in equations and also use backwards loop instead of using forward loop and then adding (size - i - 1), its just more cleaner.
And stop using using namespace std; ))
Can you add anti-cheat tests to check if the implementation doesn't use
<regex>
?This happens because of floating-point underflow. Specifically, the derivative of
(18*57.2^x-x^x+81.9*x^5.2*x^62)^x
is a very small number which is computed as0 + 0i
by the reference solution and as-6.09095e-315 + 8.56785e-314i
by my solution. In general, both results are unreliable. Overflow and underflow should be avoided in all randomly generated subexpressions.My mistake, the tests should be in the correct order now
Loading more items...