CPU: 1s
Memory: 1024MB
তুমি বাইটল্যান্ড নামের এক জায়গার এক বিশাল কোম্পানি তে চাকরি কর। এখানে তোমার কাজ হল বাকিদের কাজের সূচি নিয়ন্ত্রণ করা। বাইটল্যন্ড এর এক বছর হয় ১০০০,০০০,০০০ দিনে। এবং তাদের কোন মাস বা সপ্তাহ নেই, শুধু দিন আছে। দিনগুলো ১ থেকে শুরু হয়। এখন তোমাকে বাকি কর্মচারীদের কাজের দিনগুলো দেয়া আছে। প্রত্যেকের জন্য তার কাজ কবে শুরু হবে এবং কবে শেষ হবে তা দেয়া হবে। কাজের সুচি এমনভাবে করা যেন ২ জন কর্মচারী কখনো একই দিনে কাজ না করে।
তোমার কোম্পানি তে একজন পরিদর্শক আসবেন। তিনি এসে তোমার কাজের পরিদর্শন করবেন এবং তোমাকে কিছু প্রশ্ন জিজ্ঞেস করবেন। প্রতিটি প্রশ্নের জন্য তিনি তোমাকে একটি দিন বলবেন এবং তোমাকে উত্তর দিতে হবে যে ওইদিন আদৌ কেউ কাজ করছে কিনা। তাই তোমাকে এখন একটা প্রোগ্রাম লিখতে হবে যেন সেটি তোমাকে সঠিকভাবে সব প্রশ্নের উত্তর বলে দিতে পারবে।
You now work in a big company in Byteland. Your company hires people to do some job. You are in charge of the scheduling of workers. Each worker has given you the start and end date of their job. Byteland uses a very weird calender system which only contains days and each year consists of 1000000000 days(it has no months or weeks). The days are numbered starting from 1. Now coincidentally no two workers work on the same day(their time of work don't overlap).
The Bytelandian inspector is arriving soon and he will ask you several questions. In each question he will ask you a date and you will have to tell him if there is any worker working on that day. If you fail you may lose your job so I suggests you better get on to writing a program that can answer the queries for you.
ইনপুটের বর্ণনা
প্রথমে একটি সংখ্যা দেয়া থাকবে N। এরপরে N লাইন এর প্রতিটি তে ২টি করে সংখ্যা থাকবে যা হবে কোন কর্মচারীর কাজ শুরুর ও শেষের দিনের নম্বর। এরপরে থাকবে একটি সংখ্যা Q। যা হল তোমকে যে কয়টি প্রশ্ন করা হবে তার সংখ্যা। এরপরে Q টি লাইন এ একটি করে দিন দেয়া থাকবে।
Input Specification
The first line of the input contains an integer N(the number of workers, 1<=N<=100000). The next N lines each contain two integers, the start and end day of the worker. The next line will contain an integer Q(the number of questions asked, 1 <= Q <= 100000). The next Q lines each contain an integer, the date of the question. The schedule will be valid.
আউটপুটের বর্ণনা
তোমাকে প্রতিটি প্রশ্নের জন্য তার উত্তর ক্রমানুসারে লিখতে হবে। যদি প্রশ্নের উত্তর হ্যা হয় তবে আউটপুট দিবে "YES" অন্যথায় "NO".
Output Specification
Print Q lines, each contain either “YES”, if there is a worker working on that corresponding day, or “NO” if there is no worker on that day.
SUBTASK-1 | SUBTASK-2 | SUBTASK-3 | |
CONSTRAINTS | 1 <= N <= 100 1 <= Q <= 100 |
1 <= N <= 100000, 1 <= Q <= 100000, Every value is at most 1000000 |
1 <= N <= 100000 1 <= Q <= 100000 |
POINT | 20 | 20 | 60 |
Sample
Input | Output |
---|---|
3 1 5 10 20 30 100 2 15 25 | YES NO |
Large input file. Use scanf/printf.