You can add an 'access callback' function to the menu hook for the pages you want to block and inside that function perform your own checks against the currently logged in user. This also means you must block the page for anonymous users or the company can just logout and view the profile anyway.

For hiding in search results I see two options:

Easy solution

In search-result.tpl.php or hook_preprocess_search_results you check access and don't show it. Drawback is that the count of the total results wouldn't be correct anymore.

More advanced

Add an extra indexed field blockedcompanies which contains all ids of the blocked companies in Solr with hook_apachesolr_index_document_build. When searching: add a check on this field with hook_apachesolr_query_prepare.

Prevent a user from viewing another user's profile based on a field value
The $ABCD$ paralelograms sides are $AB,BC,CD,DA$. On these line segments there are points in the same order: $X,Y,Z,V$. We know, that: $$\frac{AX}{XB}=\frac{BY}{YC}=\frac{CZ}{ZD}=\frac{DV}{VA}=k$$

$k$ is a positive constant what is less then $\frac{1}{2}$. What is the value of $k$, if the area of $XYZV$ is 86% of the area of $ABCD$?

Can you tell me a step by step answer to this question?
