Is there a way to include a post multiple times in the same query result?

You can achieve your desired result by adding this code.

<?php 

global $post;
foreach ($p_ids as $p_id) :
    $posts = get_post($p_id);
    setup_postdata( $posts );
    the_title();
endforeach;

error code: 523