set.upper_bound(element) is much faster than upper_bound(set.begin() , set.end() , element)

Revision en1, by Vampire_Questt, 2021-09-04 18:37:59

Today while giving AtCoder Beginner Contest 217, I noticed that set.upper_bound(element) is faster than upper_bound(set.begin() , set.end() , element). During the contest I used upper_bound(set.begin() , set.end() , element) and got TLE. But after the contest I resubmitted my code with set.upper_bound(element) and got AC.

contest link : https://atcoder.jp/contests/abc217/tasks

Problem link : https://atcoder.jp/contests/abc217/tasks/abc217_d

TLE solution link : https://atcoder.jp/contests/abc217/submissions/25614807

AC solution link : https://atcoder.jp/contests/abc217/submissions/25614873

Tags #atcoder, #set, #upper_bound(), #codeforces

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Vampire_Questt 2021-09-04 18:37:59 702 Initial revision (published)