HDU 3038 How many Answers is wrong

Source: Internet
Author: User

How many Answers is wrong

Time limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others) total submission (s): 5117 Accepted Submission (s): 1948

problem DescriptionTT and FF are ... friends. Uh ... very very good friends-________-b
FF is a bad boy, he's always wooing TT-play the following game with him. This is a very humdrum game. To begin with, TT should write down a sequence of integers-_-!! (bored). Then , FF can choose a continuous subsequence from it (for example the subsequence from the third to the fifth integer I nclusively). After that, FF would ask TT what's the sum of the subsequence he chose is. The next, TT'll answer FF ' s question. Then, the FF can redo this process. In the end, FF must work out the entire sequence of integers.
Boring~~boring~~a very very boring game!!! TT doesn ' t want to play with FF @ all. To punish FF, she often tells FF the wrong answers on purpose.
The bad boy isn't a fool man. FF detects some answers is incompatible. Of course, these contradictions make it difficult to calculate the sequence.
However, TT is a nice and lovely girl. She doesn ' t has the heart to is hard on FF. To save time, she guarantees the answers be all right if there is no logical mistakes indeed.
What's more , if FF finds a answer to be wrong, he'll ignore it when judging next answers.
But there'll be, so many questions, poor FF can ' t make sure whether the current answer are right or wrong in a mom Ent. So he decides-to-write a program-to-help him with this matter. The program would receive a series of questions from FF together with the answers FF have received from TT. The aim of this program was to find what many answers is wrong. Only by ignoring the wrong answers can FF work out the entire sequence of integers. Poor FF has no time-to-do job. And now he's asking for your help~ (what asking trouble for Himself~~bad boy) InputLine 1:two integers, N and M (1 <= N <= 200000, 1 <= M <= 40000). Means TT wrote N integers and FF asked her M questions.
Line 2..m+1:line i+1 contains three Integer:ai, Bi and Si. Means TT answered FF the sum from Ai to Bi are Si. It ' s guaranteed that 0 < Ai <= Bi <= N.
You can assume this any sum of subsequence are fit in 32-bit integer. OutputA single line with an integer denotes how many answers is wrong. Sample InputTen 5171 34 66 6 1 Sample Output1

HDU 3038 How many Answers is wrong

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.