Bridge Crossing - Classic Puzzle
The overwhelming first impression I get from your code is that without the text description above, I wouldn't have a clue what it is you're trying to do.  A lot of these types of problems have some kind of prompting which helps, however your code doesn't have that, its only output is time after it's finished.

The two main improvements I'd suggest are:


Put your code in a function that defines an interface.
Use variable names that have some kind of meaning.


Implementing these two basics would go a long way to making your code easier to follow.

For example, your vector v might be people?!?

You could have a method calculate_minimum_time_to_cross_bridge, which took in a list of people and returned the time.

Whilst your variable names might have meaning to you, they have no meaning a new reader without context.

One final point is that whilst you can do this:

vector&lt;int&gt; v; int n; int time;


It's generally considered bad form.  One declaration per line means the declarations are less likely to get lost.