Found a Troll
Time limit1sMemory limit512 MB
Given N streamers' viewer trends over M periods, decide whether at least half of the non-Ralpha streamers have an absolute-difference sum above 2000 against Ralpha.
- Level
Easy3 of 10
- Topics
- Array, Simulation, Implementation
- Solved
- No attempts yet
Problem
Ralpha, a popular streamer known for his colorful curses and cute Southeastern dialect, streams games every day. He once reached the top ranks of a game, but his skill has dropped a lot, and now he fights toxic viewers who keep giving unsolicited advice every day. You have watched Ralpha's streams for a long time, and one day you discovered a shocking fact. Toxic viewers subscribe to many streamers who do not get along with Ralpha. To keep Ralpha's stream clean, you decide to find all of them yourself.
SandwichTV, the platform where Ralpha streams, has a feature: streamers who get along with each other have viewer count changes that follow a similar trend. It is also known that if the sum of the absolute differences in viewer counts over a given period exceeds , the two streamers do not get along.
For example, suppose the viewer count changes over time for streamers A, B, and C are as follows.
- A :
- B :
- C :
The sum of viewer differences between A and B over the period is , and between A and C it is . So A and B get along because their sum is or less, and A and C do not get along because their sum is greater than .
If, among the streamers a viewer subscribes to, at least half of the streamers other than Ralpha do not get along with Ralpha, then the viewer is a toxic viewer.
Given the viewer count change trends of all streamers a viewer subscribes to, including Ralpha, write a program that determines whether the viewer is a toxic viewer.
Input
The first line contains the number of streamers the viewer subscribes to and the length of the viewer count change trend.
The second line contains the values of Ralpha's viewer count change trend.
From the third line to line , each line contains the values of streamer 's viewer count change trend.
Output
If the viewer is a toxic viewer, print YES. Otherwise, print NO.
Hint
This problem has a large amount of input, so using fast input and output in your language is recommended.