mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
39 lines
656 B
Python
39 lines
656 B
Python
def problem_p03666(input_data):
|
|
import bisect
|
|
import collections
|
|
import copy
|
|
import heapq
|
|
import itertools
|
|
import math
|
|
import queue
|
|
import sys
|
|
|
|
def main():
|
|
|
|
sys.setrecursionlimit(10**7)
|
|
|
|
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
|
|
|
|
n, a, b, c, d = LI()
|
|
|
|
x = int((b - a + d * (n - 1)) / (c + d))
|
|
|
|
if x < 0 or x > n - 1:
|
|
|
|
return "NO"
|
|
|
|
return
|
|
|
|
z = c * x - d * (n - 1 - x)
|
|
|
|
if z <= b - a <= z + (d - c) * (n - 1):
|
|
|
|
return "YES"
|
|
|
|
else:
|
|
|
|
return "NO"
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|