Case 1: Only one guest there. So the thief must be him
Case 2: The data shows the timetable as below:
in time 1, #1 enter the house;
in time 2, #1 exit the house;
in time 3, #2 enter the house;
in time 4, #2 exit the house;
The cop will only ask #2. If he answer YES/YES, the thief must be him; If he answer NO/NO, the thief must be #1.
Case 3: There's a solution which cop only ask 2 times: The cop will ask #3 first,
If he answer YES/YES, the thief may be #3 or #4, then ask #4 to know who is the thief;
If he answer NO/NO, the thief may be #1 or #2. then ask #2 to know who is the thief;
he can't answer YES/NO or NO/YES.