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

Vrsar

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

의견: 0

설명

Vrsar is a small coastal town consisting of \(n\) hills. Surprisingly, all the hills, when
viewed from the sea, are arranged one behind the other so that the \(i-th\) hill is \(x@@RISE_MATH_BLOCK_0@@i\) minutes.
Iva and Mia have come to Vrsar and will be here for \(m\) days. Iva and Mia love ice
skating and want to skate every day they spend in this town. At the beginning of
the \(i-th\) day, they are \(a@@RISE_MATH_BLOCK_1@@i\) minutes for them to descend the
\(i-th\) hill. After descending from a hill, they can continue walking towards the next ice rink.
The illustration shows the first example.
Iva and Mia are \(at\) the starting point \(at\) position 1. They walk for 2 minutes \(to\) the ice rink \(on\) the hill \(at\)
position 3 and ice skate there for 5 minutes. Then they descend from the hill (in 0 minutes), continue
walking for 3 minutes \(to\) the ice rink \(on\) the hill \(at\) position 6, and ice skate there for 1 minute. \(In\) total,
they have ice skated for \(5 + 1 = 6\) minutes.
Iva and Mia are interested in determining the maximum number of minutes they can ice skate each day.
In one day, they can visit any number of ice rinks. Since they want to spend more time skating and less
time calculating, they have turned to you for help. Help them solve this problem!
Note: If Iva and Mia at the beginning of the day are at the same position as a hill, they are at the bottom
of the hill, and so they have to climb it if they want to ice skate on the ice rink on top of it.

제약

Subtask 1 (8 points): n, \(m \le 10\)

Subtask 2 (17 points): \(m = 1\), a\(1 = 0\)

Subtask 3 (19 points): n, \(m \le 1\,000\)

Subtask 4 (26 points): No additional constraints.

입력 형식

The first line contains integers \(n\) and \(m\) (\(1 \le n\), \(m \le 10^{5}\)), the number of hills and the number of days.
The \(i-th\) of the following \(n\) lines contains integers \(x@@RISE_MATH_BLOCK_0@@i\) and \(s@@RISE_MATH_BLOCK_1@@i\), t\(i\), s\(i \le 10^{9}\)), the distance of the
\(i-th\) hill from the shore, closing time of the ice rink and the time required for the descent from the hill.
The third line contains \(m\) integers \(a@@RISE_MATH_BLOCK_2@@i \le 10^{9}\)), Iva’s and Mia’s starting distance from the shore at
the beginning of the \(i-th\) day.

출력 형식

In one line, print \(m\) integers, the \(i-th\) of which is the maximum time Iva and Mia can ice skate on \(i-th\) day.

서브태스크
서브태스크점수설명

1

8점

n, \(m \le 10\)

2

17점

\(m = 1\), a\(1 = 0\)

3

19점

n, \(m \le 1\,000\)

4

26점

No additional constraints.

예제 1
입력
3 1
3 7 0
6 11 3
10 13 5
1
출력
6
예제 2
입력
3 2
5 10 3
3 6 1
1 5 0
0 3
출력
5 8
예제 3
입력
1 3
3 3 3
0 1 2
출력
0 1 2
설명

Clarification of the first example:
Take a look at the illustration in the statement.

문제 정보

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

출처 COCI 2023/2024 Contest 3

평가 및 의견

Vrsar

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

Log in to rate problems.

개별 의견

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

풀이 제출

Vrsar

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