Back to General discussions forum
Hello. Could you add the expected result please? As in previous tasks. Thank you.
Yevgeny, Hi!
Well, perhaps it is good idea, thanks. I've just tried to add it in two places:
Please tell if it helps!
hmm. that helped. but i'm not sure if the task is working correctly.
input:
5 1
1 2 3 4 5
output:
2 3 4 5 1
the result is "wrong"(
your explanation:
Wrong result for N=5 K=1: for [49 52 93 60 40] result should be [52 ...]
if you need i will send you my code
Hi, you don't actually rotate the array, you just print its elements in a different order. That's not quite the same thing.
(upd, it's me, admin again, just was testing your code and forgot to re-login)
Ah, I checked your code and probably I see there is small misunderstanding.
These BASIC
problems do not require you to output anything. Specifically in this problem you need to modify array
in your code, or rather in rotate
subroutine.
When you submit your code, the checker adds its own lines in front of yours, like this:
A
to some values (e.g. starting with 49 52 93...
as in your example)rotate
is calledA(0)
should be 52
and so onA
array, that is "in place").So you see, these BASIC
problems are not needed to teach people BASIC
(probably no one will need it) but to
have the simplified language where it is easy to check (for checker) that you invented correct algorithm.
So to conclude, checker doesn't look at what your code prints. Instead it checks contents of the array after your code runs.
Hi! For me the error message is quite different. I get an
Error for N=1000 K=500: Runtime error (line #18): Execution limit reached: 1000000 statements
even though the answer is reported to be correct and I do replace array elements in place, although I do use an extra variable to store the first element. I would appreciate any help
Hi,
A quick look at your solution indicates a complexity of O(k*n)
. That's too high to pass.