There's the line: "Also, we assume that at the points where the segments join, Shpuntik's phone never changed cells and that for each of the stations the curves of change of the signal's level do not pass through these points." in description.
I got wa on 4. And after putting this line to judge whether it suffers the condition above:
if (case_is_wrong) then DIE
I got RE on 3. I think at least case 3 is wrong, or the description is wrong!
Power on. CELL_ID:Znaika, SIGNAL_LEVEL:GREEN Signal changed. SIGNAL_LEVEL:YELLOW Signal changed. SIGNAL_LEVEL:ORANGE Signal changed. SIGNAL_LEVEL:RED Cell changed. CELL_ID:Romashka, SIGNAL_LEVEL:YELLOW Signal changed. SIGNAL_LEVEL:ORANGE Signal changed. SIGNAL_LEVEL:RED // HERE, should I output the following line? // I think we don't need, but by the description, we should... Cell changed. CELL_ID:Romashka, SIGNAL_LEVEL:ORANGE Signal changed. SIGNAL_LEVEL:YELLOW Signal changed. SIGNAL_LEVEL:GREEN Signal changed. SIGNAL_LEVEL:BLUE Signal changed. SIGNAL_LEVEL:INDIGO Signal changed. SIGNAL_LEVEL:VIOLET Signal changed. SIGNAL_LEVEL:INDIGO Signal changed. SIGNAL_LEVEL:BLUE Signal changed. SIGNAL_LEVEL:GREEN Signal changed. SIGNAL_LEVEL:YELLOW Signal changed. SIGNAL_LEVEL:ORANGE
If I am not mistaken, base station selection is made ONLY when power indicator shows RED. Otherwise we stay connected to currently selected base station (until power indicator gets RED) even if there is another one with stronger signal.
1st question: no comments, as know. Reread a problem. 2nd question: no comments. Reread a problem. 3rd question: i think it isn't print, because we haven't event "signal lost" and may still assume what cell is same 4th question: no comments. Reread a problem. ...
My 6th question: should i use ( char * ) instead off ( unsigned char * ) or vise versa for names?
Question 1 - indeed, seems like we should choose the stronger signal, not the best color, but indicator is only able to distinguish between colors, not strengths, so it's a bit unclear.
The answer to question 2 depends on what happends if distance is equal to critical.
Take a look:
1. "If the distance between the phone and a base station is less then a certain value, then the signal is ideal"
2. "If the phone is moved away from a base station further than the threshold distance, then the indicator goes indigo, then blue, green, and so on"
3. "Rc is its threshold distance within which the station's signal is shown by the violet color of the indicator"
These three statements can't be resolved clearly, IMHO. "within" means <=, while "less" means <.
As for question 4, it isn't really clear, because "The phone stays connected to the same station until its signal goes red; then it switches to the search mode and tries to select a new station", so we can't tell whether the phone is in search mode from the very beginning or no. Although this doesn't seem to affect our output, behaviour is poorly described for this problem.
Questio #1. I don't know. I tried both and got WA#8.
Question #2. "If the distance between the phone and a base station is less then a certain value, then the signal is ideal".I think its right. "within which" means such as "inside which".
Question #4. "When the phone is being turned on, it selects a station with the strongest signal. If there are several such stations, then the station with the minimal (with respect to the lexicographic order) name of the cell is selected among them." Color isn't take to account.
It probably can be extrapolated from this phrase "Violet corresponds to the strongest signal". But then it turns out that the 1st picked station can be violet only (also _strongest_ signal), and if there is no violet station nearby, it's undefined behavior :D