• [1631] Just Guess it

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • There are n games in a football tournament. Three People(Radical,Alex,Asd)'s teams are participating in it. Currently k games had already been played.
    You are an avid football fan and you very adore Radical(I know), but recently you missed the whole k games. Fortunately, you remember a guess of your friend for these k games.
    Your friend did not tell exact number of wins of each team, instead he thought that absolute difference between number of wins of first and second team will be d1 and that of between second and third team will be d2.
    You don't want any of team win the tournament,because your idol Raidcal has beat them too much times.that is each team should have the same number of wins after n games.
    That's why you want to know: does there exist a valid tournament satisfying the friend's guess such that no team will win this tournament?
    Note that outcome of a match can not be a draw, it has to be either win or loss.
  • 输入
  • A single lines will contain four space-separated integers n, k, d1, d2 (1<=n<=10^12; 0<=k<=n; 0 <= d1,d2 <= k) — data for the current test case.
  • 输出
  • For each test case, output a single line containing either "yes" if it is possible to have no winner of tournament, or "no" otherwise.
  • 样例输入
  • 3 0 0 0
    3 3 0 0
    6 4 1 0
    6 3 3 0
    3 3 3 2
  • 样例输出
  • yes
  • 提示
  • 来源
  • Radical@NBUT
  • 操作