#GL0000280. Mùa giải bóng đá (The Football Season)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Mùa giải bóng đá (The Football Season)
The Football Season
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A football team played exactly matches and gained points. Each win scores , each draw , each loss . Find nonnegative integers describing wins, draws and losses, such that and . Any valid triple is accepted.
Input
One line contains four integers : matches, total points, points per win and per draw.
Output
If impossible, print -1. Otherwise print three space-separated integers .
Subtasks
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; ; .
Examples
Example 1
Input
30 60 3 1
Output
17 9 4
Explanation
There are 30 games, worth 3 per win and 1 per draw. The displayed triple sums to 30 matches and yields exactly 60 points.
Example 2
Input
10 51 5 4
Output
-1
Explanation
There are 10 games, worth 5 per win and 4 per draw. The target exceeds the maximum total of n*w points.
Example 3
Input
20 0 15 5
Output
0 0 20
Explanation
There are 20 games, worth 15 per win and 5 per draw. The displayed triple sums to 20 matches and yields exactly 0 points.