But my teacher told me that I did it wrong, because the bolt firstly goes up (maybe after it is detached from the elevator) and then goes down. Could you correct my mistake?

Yes that's right.
The bolt starts off with the same upward velocity as the elevator at the instant of detachment.
Since it is no longer being driven upwards it describes a parabola where it first rises to a max height, then falls back first to the same height as it was when it detached.
You know the acceleration, the initial velocity, the final velocity (by symmetry) and the time so you should be able to select the appropriate formula for this.
Have you drawn a diagram?