When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

Mister_Rainbow's blog

By Mister_Rainbow, history, 3 years ago, In English

Hello everyone!

Today I was trying to solve ABC-51 Problem B. link to problem....

The editorial mentions a O(k^2) solution by looping through all possible values of x and y and figuring if a valid z exists for that x and y.

This solution had passed because the limits were not very tight. I was curious to know if there exists a faster way to solve this problem if the constraints are big!

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
3 years ago, # |
Rev. 3   Vote: I like it +1 Vote: I do not like it

In combinatorics there is a “stars and bars” approach to do it at least in O(k).