The genus of curves in p4 verifying certain flag conditions