fork download
  1. n=int(input())
  2. k,m1,m2=map(int,input().split())
  3. t=[[*map(int,input().split())]for _ in range(n)]
  4. r=0
  5. for i in range(n):
  6. for j in range(2,2+t[i][1]):
  7. smin=t[i][j]*m2;smax=t[i][j]*m1
  8. hmin=t[i][0];hmax=hmin*k
  9. if not(hmin<=smax<=hmax or hmin<=smin<=hmax or smin<=hmax<=smax or smin<=hmax<=smax):r+=1
  10. print(r)
Success #stdin #stdout 0.03s 9844KB
stdin
3
2 1 1
1 2 1 2
2 2 1 4
4 2 3 4
stdout
2