Is cardiac arrest a painful way to go?

No. People who experience cardiac arrest usually lose consciousness very rapidly so in general would not feel a lot of pain.
Maybe. If cardiac arrest is the result of infarction the angina associated with the event can be painful. If cardiac arrest is due to an arrhythmia you might pass out before noticing what even happened. In between these two extremes there is a huge range of symptoms.