Considering the D-minor key signature has one flat (B flat), the second chord will best be understood as a B-flat chord, not an A-sharp chord. Also, the Roman numerals will be iv--VI--i
; the first chord (G minor) is built on the fourth scale degree, not the third.
As for the C-sharp major chord, although it is outside the key of D minor, there are a few ways of conceptualizing this:
First, C sharp is the leading tone in D minor. Since the leading tone is such a strong impetus within dominant chords, we can view this C-sharp chord as a dominant substitute, thus it's just functioning as a dominant to get you back to tonic.
Secondly, let's think about the pitches involved in the C-sharp and D-minor triads. The first has C# E# G#
, the latter D F A
. You'll note that the E#
of the first chord is the same as the F
in the latter. Some composers use this relationship, where the chordal third stays the same, but the boundary perfect fifth moves by semitone. (Some call this a slide relationship/transformation, because the perfect fifth slides by one semitone.)
One other possibility is that it is a secondary chord that resolves later in the piece. If so, it would want to move to F#; perhaps F# plays a larger role later in the piece?
Finally, let's imagine it was a dominant for F#. If this dominant of F# were to resolve deceptively, it could move to VI of F#, or a D-major triad. Although the triad in your question is D minor, we nevertheless see how a C# triad can easily resolve to a D triad.