F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Dylans loves polynomial

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 415    Accepted Submission(s): 114


Problem Description
First Dylans is given $N$ points $(x_i,y_i)$ in Rectangular Plane Coordinate System.

It guarantees that each $x$ is different.

And there are $Q$ questions.Each question are three numbers:$(L,R,x)$.

His task is to make up a polynomial that its highest coefficient is equal to $(R-L)$.

To check his polynomial,he needs to print the value£¨$y$£İof the polynomial by $x$.

Because the value and the pair of points can be very huge,so each calculate must mod $1000000007$.

All points and number $x$ in query are positive integers and not bigger than $250000$.

$2 \leq N \leq 3000,1 \leq Q \leq 3000, 1 \leq L,R \leq N,R>L$
 

Input
In the first line there is a number $N$.

In the next $N$ lines there are two numbers $(X_i,Y_i)$.

Then in the next line there is a number $Q$.

In the next $Q$ lines there are three numbers$(L,R,x)$
 

Output
For each question,output the value of polynomial.
 

Sample Input
4 1 1 2 2 3 3 4 4 3 1 2 1 2 3 3 2 4 1
 

Sample Output
1 3 1
 

Hint

You shouldn't print any space in each end of the line in the hack data.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-21 21:42:51, Gzip enabled