-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.py
More file actions
executable file
·41 lines (29 loc) · 723 Bytes
/
Copy pathsol.py
File metadata and controls
executable file
·41 lines (29 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from math import ceil
def solve(n, target):
score = 0
correct = 0
wrong = 0
unattempted = 0
if score < target:
needed = ceil(target / 3)
if needed <= n:
correct += needed
score += 3 * needed
n -= needed
if score > target:
needed = score - target
if needed <= n:
wrong += needed
score -= needed
n -= needed
unattempted = n
if score == target:
print("YES")
print(f"{correct} {wrong} {unattempted}")
else:
print("NO")
if __name__ == "__main__":
T = int(input())
for _ in range(T):
N, X = map(int, input().split())
solve(N, X)