| TeamsCode 2026 Spring Contest |
|---|
| Закончено |
There is an array $$$a$$$ of size $$$10^9$$$, initially all containing zeroes. There are $$$n$$$ operations done to the array.
The $$$i$$$-th operation specifies operation number $$$op_i$$$ and bounds $$$l_i \le r_i$$$.
After all operations, there are $$$q$$$ queries. The $$$j$$$-th query specifies bounds $$$L_j\le R_j$$$, and you have to determine the sum $$$a_{L_j}+a_{L_j+1}+\ldots+a_{R_j}$$$ modulo $$$10^9+7$$$.
The first line contains an integer $$$n$$$ ($$$1\le n\le 10^6$$$).
The $$$i$$$-th of the next $$$n$$$ lines contains three integers $$$op_i$$$, $$$l_i$$$, and $$$r_i$$$ ($$$1\le op_i\le 2$$$, $$$1\le l_i \le r_i\le 10^9$$$).
The next line contains an integer $$$q$$$ ($$$1\le q\le 10^6$$$).
The $$$j$$$-th of the next $$$q$$$ lines contains two integers $$$L_j$$$ and $$$R_j$$$ ($$$1\le L_j\le R_j\le 10^9$$$).
—
Tests in subtasks are numbered from $$$1-20$$$ with samples skipped. Each test is worth $$$\frac{100}{20}=5$$$ points.
Test $$$1$$$ satisfies $$$op_i=1$$$, $$$l_i=r_i \le 10^6$$$, and $$$R_j \le 10^6$$$.
Test $$$2$$$ satisfies $$$op_i=1$$$, $$$r_i \le 10^6$$$, and $$$L_j=R_j \le 10^6$$$.
Tests $$$3-4$$$ satisfy $$$op_i=1$$$, $$$r_i \le 10^6$$$, and $$$R_j \le 10^6$$$.
Tests $$$5-6$$$ satisfy $$$r_i \le 10^6$$$, and $$$L_j=R_j \le 10^6$$$.
Tests $$$7-8$$$ satisfy $$$r_i \le 10^6$$$, and $$$R_j \le 10^6$$$.
Tests $$$9-10$$$ satisfy $$$op_i=1$$$ and $$$l_i=r_i$$$.
Tests $$$11-12$$$ satisfy $$$op_i=1$$$ and $$$L_j=R_j$$$.
Tests $$$13-15$$$ satisfy $$$op_i=1$$$.
Tests $$$16-17$$$ satisfy $$$L_j=R_j$$$.
Tests $$$18-20$$$ satisfy no additional constraints.
For the $$$j$$$-th query, output the sum $$$a_{L_j}+a_{L_j+1}+\ldots+a_{R_j}$$$ modulo $$$10^9+7$$$ on a separate line.
31 1 32 2 42 1 531 32 41 5
12 17 24
Since the input size might be large, please add ios_base::sync_with_stdio(0); cin.tie(0); to the start of the main function.
—
Problem Idea: culver0412
Problem Preparation: culver0412
Occurrences: Novice K, Advanced H
| Название |
|---|


