RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00360

Relativnost

Unrated 레이팅 미적용
난이도
4s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(1^{st}\) round, October \(17^{th}\), 2015

Young Luka is an art dealer. He has N clients and sells artistic paintings to each client.
Each client can purchase either colored paintings or black and white paintings, but not both.
The client denoted with i wants to purchase at most ai colored paintings and at most bi black and white
paintings.
The client will always purchase at least one paintings. Luka has an almost unlimited amount of
paintings, so the number of paintings required from the clients is never a problem.
Luka doesn’t like selling black and white paintings and knows that if less than C people get colored
paintings, it will make him feel sad.

His clients constantly keep changing their requests or, in other words, the number of paintings they
want to purchase. Because of this, Luka is often troubled by the question: “How many different
purchases are there, so that at least C clients get at least one colored painting?” Help Luka and save him
from his worries.

제약

In test cases worth 30% of total points, it will hold that N and Q are smaller than 1000.

입력 형식

The first line of input contains two integers N, C (\(1 \le N \le 100\,000\), \(1 \le C \le 20\)).
The second line of input contains N integers ai (\(1 \le ai \le 1\,000\,000\,000\)).
The third line of input contains N integers bi (\(1 \le bi \le 1\,000\,000\,000\)).

The fourth line of input contains the number of requirement changes Q (\(1 \le Q \le 100\,000\)).
Each of the following Q lines contains three integers, the label of the person changing the requirements
P (\(1 \le P \le N\)), the maximal number of colored paintings they want to purchase aP (\(1 \le aP \le 1\,000\,000\)
000) and the maximal number of black and white paintings they want to purchase bP (\(1 \le bP \le 1\,000\)
000 000).

출력 형식

The output must consist of Q lines where each line contains the number of different purchases modulo
10 007.

예제 1
입력
2 2
1 1
1 1
1
1 1 1
출력
1
예제 2
입력
2 2
1 2
2 3
2
1 2 2
2 2 2
출력
4
4
예제 3
입력
4 2
1 2 3 4
1 2 3 4
1
4 1 1
출력
66
설명

Clarification of the first example: After the first client changes his request from (1, 1) to (1, 1) -
nothing really changes, the number of ways to sell paintings is 1. The one and only way to sell paintings
is to sell the first client one colored painting, and the second client should be sold one colored painting
as well. Every client is required to get at least one colored painting because C=2, which means that
there should be at least 2 clients with colored paintings.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2015/2016 Contest 1

평가 및 의견

Relativnost

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Relativnost

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8