Traditional traffic control systems based on traffic light have achieved a great success in reducing the average delay of vehicles or in improving the traffic capacity. The main idea of these systems is based on the optimization of the cycle time, the phase sequence, and the phase duration. The right-of-ways are assigned to vehicles of one or several movements for a specific time. With the emergence of cooperative driving, an innovative traffic control concept, Autonomous Intersection Management (AIM), has emerged. In the framework of AIM, the right-of-way is customized on the measurement of the vehicle state and the traffic control turns to determine the passing sequence of vehicles. Since each vehicle is considered individually, AIM faces a combinatorial optimization problem. This paper proposes a dynamic programming algorithm to find its optimal solution in polynomial time. Experimental results obtained by simulation show that the proper arrangement of the vehicle passing sequence can greatly improve traffic efficiency at intersections.