14 views

Uploaded by Karen Failoc Quispe

- 2009-09-29 How to Write an Explanation in Math
- Base Convert
- MSHS 2008 Sec 4 Prelim 2 a Maths Paper 1
- Session Guide for Real Numbers
- glenda
- dhb-java
- assign minesweeper game
- PTest 1 Revision Worksheet
- Basic Mathematics
- Math Decimals
- 117896682 Rancangan Tahunan Math Tahun 6 2013 Bi
- Hubbard Eialg3e Ssm Chapter 01
- Excel Function Directory
- Binary Division
- Binomial Form
- Practice Programming Exercises
- 6thmathcurriculumoverview
- Polynomials
- chap 6
- Errata Nlaa.second

You are on page 1of 2

Helen is a hyperactive girl. She wants to schedule her activities so that at any moment of the day there is at

least one thing she can do. She does not care if her activities overlap in time, as long as every moment of her

day has an activity scheduled.

Helen divided the day in a particular way. The day starts at time 0 and finishes at time M. Each moment of the

day is represented by a real number between 0 and M, inclusive. Helen made a list of all possible activities,

with their start and finish times. Now she must decide which subset of activities to schedule.

If an activity starts at time S and finishes at time F, then we say that it covers all moments between S and F,

inclusive. Helen does not want to waste any activities, so she will only choose minimal subsets of activities

that cover the day to be scheduled. A subset of activities is a minimal subset that covers the day if and only if:

• every moment of the day is covered by at least one activity of the subset; and

• removing any of the activities from the subset would leave at least one moment of the day uncovered.

Note that some moments of the day may be covered by more than one activity.

Given the list of possible activities for one day, you must help Helen by determining how many distinct

minimal subsets cover the day.

Input

Each test case is given using several lines. The first line contains two integers M and N, representing

respectively the highest value for a moment in the day (1 M 109) and the number of possible activities for

the day (1 N 100). Each of the next N lines describes one possible activity and contains two integers S and

F, representing respectively the start and finish times of the activity (0 S<F M).

Output

For each test case output a single line with a single integer representing the number of minimal subsets that

cover the day. To make your life easier, print the remainder of dividing the solution by 108.

Sample Input

8 7

0 3

2 5

5 8

1 3

3 6

4 6

0 2

1 1

0 1

2 1

0 1

0 0

Sample Output

4

1

0

- 2009-09-29 How to Write an Explanation in MathUploaded bysamjshah
- Base ConvertUploaded bybrainbarshan
- MSHS 2008 Sec 4 Prelim 2 a Maths Paper 1Uploaded byhypetuition9993
- Session Guide for Real NumbersUploaded byFelix Llamera
- glendaUploaded byMark Almelia
- dhb-javaUploaded bybernasek
- assign minesweeper gameUploaded byIsseusagi Azalia
- PTest 1 Revision WorksheetUploaded byShri Neeru
- Basic MathematicsUploaded byAbdulhaq Sadiqi
- Math DecimalsUploaded bycairo861
- 117896682 Rancangan Tahunan Math Tahun 6 2013 BiUploaded byNajwa Nur
- Hubbard Eialg3e Ssm Chapter 01Uploaded bysumlee naratawa
- Excel Function DirectoryUploaded byPhani Krishna Badipati
- Binary DivisionUploaded bySANTOSH4176
- Binomial FormUploaded byKimo Keno
- Practice Programming ExercisesUploaded byJay Robert del Rosario
- 6thmathcurriculumoverviewUploaded byapi-168773958
- PolynomialsUploaded byNidhi Shrivastava
- chap 6Uploaded byMclory Iruotsam
- Errata Nlaa.secondUploaded byYesicaAquino
- Errata for Digital Signal Processing A Computer Based Approach 4th edition by Sanjit MitraUploaded byderpington
- Cat Video ListUploaded byaryan20464
- 3023PIDUploaded byOmprakash Verma
- Release paragraphUploaded byMark Richard Hilbert(Mark Richard Rossetti)
- chp 13 notes 13.4-13.7 MMUploaded byNitesh Nagesh
- Models in MindUploaded bytarun gehlot
- Programming Assignment 1Uploaded byFrederick Koo
- Chapter 1.2 Real Number SystemUploaded byEmrico Luiz Perez
- About 7Uploaded byInfo
- WE1Uploaded byjj012586

- Introduction to RFUploaded byemad11518
- Differences Between Staphylococcus and Streptococcus - Microbiology NotesUploaded bySareeya Shre
- Unistrut UK Mini 090214 WebUploaded bykurtain
- Electrical-Engineering-portal.com-Calculation Example of Small Photovoltaic PV Residential StandAlone SystemUploaded byPrince Blissful
- DAFTAR PUSTAKA CA Mamae LimfedemaUploaded byMutiara Riahna Sitepu
- Quantification Of Solid pollutants along Mikumi National Parks' HighwayUploaded byTryphone Nyahinga
- Yealink Business HD IP DECT PhoneUploaded byWebAntics.com Online Shopping Store
- Of the WorldUploaded byObltSB
- Product Diversification in FloricultureUploaded byanjukb_anjalikb
- HardwareUploaded byatul mishra
- EthicsUploaded byPrashanthChauhan
- Apple Pro Keyboard Dis AssemblyUploaded byflorinMol
- A DSP Implementation of OFDM Acoustic ModemUploaded byrettyraja
- Chichawatni Road - Kamalia ExchangeUploaded byraja_liaqat
- Black Line Pro Program 020808Uploaded byDrshahril Zulkarnain
- Aristotle of SoulUploaded bySubhani Kusuma Dewi
- 10800087_ap-3 Pricing StrategyUploaded byKirandeep Singh Gandham
- DiamondsUploaded byTommyT32
- shark key finalUploaded byapi-272193369
- Pelvic Floor Ultrasound - A ReviewUploaded byahmadcaesar
- Wire Rope InspectionUploaded byCristian Hugo
- Alcatel 7342 Isam OltUploaded bypantod2002
- Construction Mgr;Project Manager;Sr. Project ManagerUploaded byapi-72678201
- geometry unit 4 testUploaded byapi-210608556
- Geography and Natural Resources of the PhilippinesUploaded byKriz Nha
- MAGWAY UNIVERSITY meets PERMACULTURE .pdfUploaded byBilly Copeland
- 00-Flash Flood Risk Assessment for Kyushu Island, JapanUploaded byAdly Al-Saafin
- Mumbai CollegesUploaded byऋषिकेश कोल्हे पाटिल
- YOGAṬAṬṬVA-UPANISHAḌUploaded byrajeshhorizon
- Par Mod Project 1Uploaded byParmod Kaushik