When you say "the rock hits" is it solid rock or "rocks" ?
Either way sand will
not stop the posts heaving.
The only way to put the posts in correctly without future problems is to sink them in 32" (depends on your frost line) and concrete them in.
Sorry for the extra hard work but it's the only way to do it right.
