CF1244C.The Football Season

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets ww points, and the opposing team gets 00 points. If the game results in a draw, both teams get dd points.

The manager of the Berland capital team wants to summarize the results of the season, but, unfortunately, all information about the results of each match is lost. The manager only knows that the team has played nn games and got pp points for them.

You have to determine three integers xx , yy and zz — the number of wins, draws and loses of the team. If there are multiple answers, print any of them. If there is no suitable triple (x,y,z)(x, y, z) , report about it.

输入格式

The first line contains four integers nn , pp , ww and dd (1n1012,0p1017,1d<w105)(1 \le n \le 10^{12}, 0 \le p \le 10^{17}, 1 \le d < w \le 10^{5}) — the number of games, the number of points the team got, the number of points awarded for winning a match, and the number of points awarded for a draw, respectively. Note that w>dw > d , so the number of points awarded for winning is strictly greater than the number of points awarded for draw.

输出格式

If there is no answer, print 1-1 .

Otherwise print three non-negative integers xx , yy and zz — the number of wins, draws and losses of the team. If there are multiple possible triples (x,y,z)(x, y, z) , print any of them. The numbers should meet the following conditions:

  • xw+yd=px \cdot w + y \cdot d = p ,
  • x+y+z=nx + y + z = n .

输入输出样例

  • 输入#1

    30 60 3 1
    

    输出#1

    17 9 4
    
  • 输入#2

    10 51 5 4
    

    输出#2

    -1
    
  • 输入#3

    20 0 15 5
    

    输出#3

    0 0 20
    

说明/提示

One of the possible answers in the first example — 1717 wins, 99 draws and 44 losses. Then the team got 173+91=6017 \cdot 3 + 9 \cdot 1 = 60 points in 17+9+4=3017 + 9 + 4 = 30 games.

In the second example the maximum possible score is 105=5010 \cdot 5 = 50 . Since p=51p = 51 , there is no answer.

In the third example the team got 00 points, so all 2020 games were lost.

首页