ACM algorithm  OJ