TopCoder SRM 488 DIV 2

Problem Check Points
250 240ぐらい
500 - -
1000 - -

250が超簡単で、500が鬼畜問というひどい構成。
500の正解者10人しかいなかったんだぜ・・・?
でも250はかなり早く解けたので、順位がすごく高かったです、60位ぐらい。

Problem 250 TheBoredomDivTwo

問題

John and Brus are bored. They have n+m common friends. The first n of them are bored and other m are not. John chooses the j-th (1-based) friend for a talk. If the friend is not bored, he becomes bored after the talk. Brus does the same with the b-th (1-based) friend. Note that John and Brus can't choose the same friend. You have to find the number of bored friends after the talks.

My code
class TheBoredomDivTwo {
public:
  int find(int n, int m, int j, int b) {
	  int ans = n;
	  if(j>n) ans++;
	  if(b>n) ans++;
	  return ans;
  }
};

Problem 500 TheBoringStoreDivTwo

問題

John and Brus are going to open a boring store. They would like to have a really boring name for it. John has one wooden plate with an old store name on it. Brus also has one. Now they need to compose two plates with the same name (case-sensitive) for the new store. They would like to produce these new plates as follows:

  1. John will cut two pieces from his plate. Each of the pieces will contain a non-empty contiguous substring of the name written on the original plate and the locations of these two substrings within the plate will not overlap. For example, if the name on John's plate is "abCDeF", then he can cut pieces with "bC" and "e" or with "CDeF" and "ab", but he can't cut pieces with "aC" and "eF" ("aC" is not a contiguous substring), with "abCD" and "" (empty substring is not allowed) or with "DeF" and "CD" (locations of the substrings overlap). Let's denote the substrings on John's pieces as A and B.
  2. Brus will cut two pieces from his plate according to the same rules. Let's denote the substrings on these pieces as C and D.
  3. One plate for the new store will be constructed as A + C (where '+' means concatenation of two strings) and another plate will be constructed as B + D.

You are given two strings J and B - the names on John's and Brus's plates respectively. Return the longest possible name for the new store that can be achieved as described above. In case of a tie choose the one that comes first lexicographically. If it is impossible to achieve the goal, return an empty string.

Problem 1000 TheBoringGameDivTwo

問題

John and Brus are very bored. That's why they decided to invite their friend and play a boring shooter game. John and Brus are on the first team and the friend is the only player of the second team. The game consists of X rounds. During a round players may shoot each other, but a player can't shoot himself. If a player shoots some player from the opposite team his score is increased by one and if he shoots his teammate his score is decreased by one. Once a player is shot, he can't shoot other players and other players can't shoot him until the end of the current round. A round ends when all the players on one of the teams are shot.

You are given six integers. scoreJ, scoreB and scoreF are scores of John, Brus and the friend, respectively. killedJ, killedB and killedF are the number of times John, Brus and the friend were shot, respectively. Return the vector containing exactly two elements, where the first element is the smallest possible value of X and the second element is the largest possible value of X. If there are no possible values of X, return an empty vector .