‘post’ only for editor and administrator

The registered capabilities (and the other features) for registered post types are not saved in the database, but in a global variable, $wp_post_types.

Being a global variable, editing it is easy. However you’ll also need to manually remove the menu item, otherwise authors and contributors will be able to see it even if they cannot create/edit posts.

In following function I’ll set the capabilities for post post type coping ones from page post type.

add_action('init', 'restrict_posts', 1); // registration run on init with priority 0
add_action('admin_menu', 'remove_post_from_menu', 1);

function restrict_posts() {
  global $wp_post_types;
  $wp_post_types['post']->cap = clone $wp_post_types['page']->cap;
}

function remove_post_from_menu() {
  if ( current_user_can('edit_others_pages') ) return;
  remove_menu_page('edit.php');
}