My submission 114580614 and submission 114581483 for problem D educational round 108 gave runtime error in C++17 and C++14 respectively whereas submission 114582152 got accepted in C++11. Can someone explain?
UPD: I think there was some problem in the line 49-50 because it may be possible that length of prof < n, but why did the code work in C++11 ??
for (int i=0;i<n;i++) prof[i] = 0;
Thanks
Change this:
to this:
but in this case WA4 :C
Whoa, your runtime error codes now gives AC in c++17 now. This is really strange...
Undefined behavior. Also, hacked
What test case did you use to hack? And why did the code pass pretests in the first case?
I hacked it with simple case of
You are accessing out of bounds. It is an undefined behavior. Hence, unpredictable results.
Undefined behaviour:
as here it is not necessarily has a length of n
Let's say that n=4
So the runtime error is correct expected behaviour as your array has length less than n