포럼
문제 ICPC00256

F. Firing the Phaser

설명

As captain of your space ship you have never encountered a more fierce enemy than the one you have snuck upon now.

You immediately bring out the big phaser cannon hoping to take out the flagship before they discover you.

There is no room for mistakes and the shot will have to be perfect if you are to stand any chance at all against the flagship of the enemy.

You start charging the phaser beam and retrieve the room layout of the flagship from the archives. You are situated directly above the enemy, from where the layout of the flagship can be modeled by a two-dimensional map of the rooms of the flagship. In this map, each room is a rectangle with sides parallel to the \(x\) and \(y\) axes (rectilinear), and no two rooms intersect (not even in a single point).

The phaser beam is configured by giving a point \((x, y)\) and an angle \(\vartheta\). The phaser beam will start at \((x, y)\) and travel a distance \(\ell\) in the direction specified by \(\vartheta\), causing severe damage to every room touched by the phaser beam. Due to this, you aim at hitting as many rooms as possible.

The phaser beam is almost fully charged and the only missing piece is an optimal configuration of the weapon. Unfortunately, it turns out to be harder than you expected. However, there are still ten seconds before the charging is completed and hence you decide to make a computer program to solve the problem.

제약
입력 형식

The first line of input consists of two integers \(r\) and \(\ell\) (\(1 \le r \le 15\), \(1 \le \ell \le 1\,000\)) where \(r\) is the number of rooms in the flagship and \(\ell\) is the length of a shot of the phaser.

Then follow \(r\) lines, each of which contains four integers \(x_1\), \(y_1\), \(x_2\), \(y_2\) (\(0 \le x_1 < x_2 \le 1\,000\), \(0 \le y_1 < y_2 \le 1\,000\)), indicating that there is a room in the flagship with lower left corner \((x_1, y_1)\) and upper right corner \((x_2, y_2)\).

출력 형식

Output one line with the maximum number of rooms that can be hit by one phaser beam. Recall that if the beam touches a room it is counted as a hit.

You may assume that the answer is numerically stable in the following sense: if all rooms are expanded by a distance of \(10^{-6}\) in all four directions, the answer does not change.

예제 1
입력
5 8
2 1 4 5
5 1 12 4
5 5 9 10
1 6 4 10
2 11 7 14
출력
4
예제 2
입력
3 6
2 2 3 3
5 3 6 4
6 6 7 7
출력
3
문제 정보

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

출처 ICPC NCPC 2018

평가 및 의견

F. Firing the Phaser

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

Log in to rate problems.

개별 의견

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

풀이 제출

F. Firing the Phaser

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