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

Zombie Apocalypse

설명

Vito is obsessed with the new hit video game Zombie Apocalypse. He is currently
facing the following challenge: \(m\) zombies are headed toward the city and will
attack it if he doesn’t stop them.
More specifically, the zombies are located in a secret cave \(n\) meters away from the
city and leave the cave one by one. The zombies walk toward the city at a speed
of 1 meter per second, and there is a one-second pause between two consecutive
zombies leaving the cave.
Thus, after the first second there is one zombie 1 meter away from the cave; after the second second there
are zombies 1 and 2 meters away; after the third second there are zombies 1, 2, and 3 meters away, and so
on. Whenever a zombie passes the \(n\)-th meter, it reaches the city.
According to the rules of the game, Vito is allowed to drop \(k\) bombs on the path between the cave and
the city in order to stop the attack. For each bomb, he has chosen:
• the position (distance from the cave) where the bomb is dropped,
• the radius of the bomb, and
• the time (in seconds) when the bomb is dropped.
A bomb with radius \(r\) dropped at position \(x\) at time \(t\) will destroy a zombie if it is located at position \(y\)
at time \(t\) such that the distance between \(x\) and \(y\) is at most \(r\) meters, i.e., |\(x - y\)| ≤\(r\). Zombies that have
already reached the city are not affected by bombs. Once a zombie is destroyed, it can no longer continue
its journey toward the city.
Vito can choose for the bombs to be dropped with any position, radius, and time, and multiple bombs
can occur at the same time, even at the same position.
Given Vito’s choices for the \(k\) bombs, determine how many zombies will reach the city.

제약

Subtask 1 (13 points): \(m = 1\)

Subtask 2 (27 points): \(k = 1\)

Subtask 4 (30 points): No additional constraints.

입력 형식

In the first line there are three natural numbers \(n\), \(m\), and \(k\) (\(1 \le n\), m, \(k \le 200\)), the length of the path
between the cave and the city, the number of zombies, and the number of bombs.
In each of the following \(k\) lines there are three natural numbers \(x\), \(r\), and \(t\) (\(1 \le x \le n\), \(0 \le r \le n\), 1 ≤
\(t \le 500\)), the distance in meters from the cave at which one of the bombs is dropped, the radius of that
bomb in meters, and the time at which the bomb is dropped in seconds.

출력 형식

In the first and only one line, write one number, the number of zombies that managed to reach the city.

예제 1
입력
6 3 3
3 1 2
5 0 7
4 4 8
출력
1
예제 2
입력
7 7 1
3 2 6
출력
2
예제 3
입력
3 3 1
3 3 3
출력
0
설명

Clarification of the first example:
time: 0,
cave: {z, z, z},
path: (0, 0, 0, 0, 0, 0),
city: {}
time: 1,
cave: {z, z},
path: (z, 0, 0, 0, 0, 0),
city: {}
time: 2,
cave: {z},
path: (z, z, 0, 0, 0, 0),
city: {}
time: 2,
cave: {z},
path: (z, z, 0, 0, 0, 0),
city: {}
time: 2,
cave: {z},
path: (z, 0, 0, 0, 0, 0),
city: {}
time: 3,
cave: {},
path: (z, z, 0, 0, 0, 0),
city: {}
time: 4,
cave: {},
path: (0, z, z, 0, 0, 0),
city: {}
time: 5,
cave: {},
path: (0, 0, z, z, 0, 0),
city: {}
time: 6,
cave: {},
path: (0, 0, 0, z, z, 0),
city: {}
time: 7,
cave: {},
path: (0, 0, 0, 0, z, z),
city: {}
time: 7,
cave: {},
path: (0, 0, 0, 0, z, z),
city: {}
time: 7,
cave: {},
path: (0, 0, 0, 0, 0, z),
city: {}
time: 8,
cave: {},
path: (0, 0, 0, 0, 0, 0),
city: {z}
time: 8,
cave: {},
path: (0, 0, 0, 0, 0, 0),
city: {z}
time: 8,
cave: {},
path: (0, 0, 0, 0, 0, 0),
city: {z}

문제 정보

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

출처 COCI 2025/2026 Contest 4

평가 및 의견

Zombie Apocalypse

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

Log in to rate problems.

개별 의견

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

풀이 제출

Zombie Apocalypse

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