Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

### hongjun-7's blog

By hongjun-7, history, 2 years ago, ,
int main() {
{
//Wrong
set  s = {1,2,3,4,5};
auto it = s.lower_bound(3);
s.erase(it);
it++;
printf("%d\n", *it);
} {
//Correct 1
set  s = {1,2,3,4,5};
auto it = s.lower_bound(3);
s.erase(it++);
printf("%d\n", *it);
} {
//Correct 2
set  s = {1,2,3,4,5};
auto it = s.lower_bound(3);
it = s.erase(it);
printf("%d\n", *it);
}
}


• +132

By hongjun-7, 3 years ago, ,

Hi, Codeforces!

I'm looking for some problems which C++ STL 'set' can be used effectively for.

Thanks!

• +13

By hongjun-7, history, 4 years ago, ,

You can see the problem here.

Every two circles touch in at most one point (in particular no circle can be contained in a different circle).

Does anyone have some ideas about the problem?

• +21

By hongjun-7, history, 4 years ago, ,
1. Smallest Enclosing Circle : 2-Dimension Problem (Written in Korean. Output is the smallest enclosing circle's position on the first line and the radius on the second line.)

2. Smallest Enclosing Sphere : 3-Dimension Problem

Let P(X, Y, Z) = (Average(x(i)), Average(y(i)), Average(z(i)))

Average(x(i)) = Sum(x(i)) / N

Average(y(i)) = Sum(y(i)) / N

Average(z(i)) = Sum(z(i)) / N

P is inside of the points' convex hull.

Now find the farthest point(M) to P.

Move P toward M a little bit and the ratio should be small and decreasing.

If there is no such a movement, that is the answer.

Total Time Complexity is O(N * constant number)

(We can reduce 'N' by getting convex hull.)

My 2-Dimension Problem's Solution Code

My 3-Dimension Problem's Solution Code