409817: GYM103797 D Dynamic Duo

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Dynamic Duotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

After working very hard for it, the lovely dynamic duo, made up of Evandro Lins and Hebert Henriques, is finally part of the group that assists the lieutenants at some odd military academy. Due to this being an honor of immense prestige, when the second year students went on an expedition they were assigned the roles of shooting range assistants to a commanding lieutenant.

Like always, the shooting instruction will be performed in an unusual manner. First of all, the lieutenant lines up all of the $$$N$$$ students, side by side, with each person facing their respective target. For some odd reason, during the instruction, both Evandro and Hebert are only able to perform very specific tasks. Evandro is able to quickly find out whether a student in the firing range has enough ammo to fire a specific amount of rounds. Complementarily, Hebert, in some weird way, is able to quickly give bullets to students, however, the caveat is that he's only capable of doing that to a continuous sequence of students in the firing range and giving the same amount to all of them.

With this knowledge, the lieutenant is prepared to proceed with the shooting instruction; $$$Q$$$ commands will be given out to the duo. When he shouts his command, it'll be directed towards Hebert, commanding him to give out bullets to some students. When he's asking something, it'll be directed towards Evandro, asking if a student has enough ammo to fire a specific amount of rounds. If the student has enough ammo, he will be asked to fire them. Everyone begins with $$$0$$$ bullets.

Input

The first line contains two integers, $$$N$$$ and $$$Q$$$ $$$(1 \le N, Q \le 10^5)$$$ — the number of students and the number of commands given out to the duo, respectively.

Each of the next $$$Q$$$ lines represents a command. Each command will start with a character, indicating whether the lieutenant is shouting or asking.

If the character is an exclamation mark !, then three numbers, $$$l$$$, $$$r$$$, $$$x$$$, will follow $$$(1 \le l \le r \le n)$$$ and $$$(1 \le x \le 10^9)$$$ — meaning that Evandro has to deliver $$$x$$$ bullets for the students in positions $$$l$$$ to $$$r$$$.

If the character is a question mark ?, then two numbers, $$$p$$$, $$$x$$$, will follow $$$(1 \le p \le n)$$$ and $$$(1 \le x \le 10^{12})$$$ — meaning that the lieutenant is asking if the student in position $$$p$$$ is able to fire $$$x$$$ rounds. If he's able, he then fires the asked amount.

Output

For each ? query, print yes sir if the student is able to fire the amount asked or negative otherwise.

ExamplesInput
10 4
? 7 9
! 1 10 17
? 7 9
? 7 9
Output
negative
yes sir
negative
Input
5 7
! 1 5 13
! 2 3 123832
? 5 13
! 1 5 12873
? 5 1337
! 1 4 128312
? 3 278302
Output
yes sir
yes sir
negative

加入题单

上一题 下一题 算法标签: