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

Sabor

설명

The president of the political party in power is holding a conference in the party headquarters.
Politicians, members of the party, live in a t\(wo-di\)mensional grid, one member in each cell (except in
cells containing obstacles). The headquarters are located in cell (0, 0). This is also where the president
of the party lives.
Politicians make steps in one of the four directions (up, down, left, right), moving to one of the four
adjacent cells in one step. They can't enter cells with obstacles. The conference will be attended by all
party members that can reach headquarters in S steps or less. Each member coming to the conference
will take the shortest route to headquarters (or any such route, if there is more than one).
The president has observed that politicians change their party affiliation with each step they take,
becoming a member of the other party (there are only two parties on the political scene).
Write a program that determines how many politicians come to the conference as members of the
party in power, and how many come as members of the opposing party.

제약
입력 형식

The first line contains two integers B and S (\(0 \le B \le 10\,000\), \(1 \le S \le 10\,000\,000\)), the number of
obstacles and the largest number of steps from the task description.
Each of the following B lines contains two integers, the coordinates of one obstacle. The absolute value
of both coordinates will be less than 1000.
No two obstacles will be in the same cell and there will be no obstacle in cell (0, 0).

출력 형식

Output two integers on a single line separated by a space, the number of politicians that come to the
conference as members of the party in power and the opposing party, respectively.

예제 1
입력
0 2
출력
9 4
예제 2
입력
4 5
-1 1
0 -1
0 1
1 0
출력
10 16
예제 3
입력
4 50000
1 1
-1 -1
1 -1
-1 1
출력
2500099997 2500000000
문제 정보

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

출처 COI 2007

평가 및 의견

Sabor

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

Log in to rate problems.

개별 의견

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

풀이 제출

Sabor

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