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

J. Tile Cutting

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

의견: 0

설명

Youssef is a Moroccan tile installer who specializes in mosaics like the one shown on the right. He has rectangular tiles of many dimensions at his disposal, and the dimensions of all his tiles are integer numbers of centi\(me- te\)rs. When Youssef needs parallelogr\(am-sh\)aped tiles, he cuts them from his supply on hand. To make this work easier, he invented a tile cutting machine that superimposes a centimeter grid on the cutting surface to guide the cuts on the tiles. Due to machine limitations, aesthetic sensibilities, and Youssef’s dislike of wasted tiles, the following rules determine the possible cuts. 1. The rectangular tile to be cut must be positioned in the bottom left corner of the cutting surface and the edges must be aligned with the grid lines. 2. The cutting blade can cut along any line connecting two different grid points on the tile boundary as long as the points are on adjacent boundary edges. 3. The four corners of the resulting parallelogram tile must lie on the four sides of the original rectangular tile. 4. No edge of the parallelogram tile can lie along an edge of the rectangular tile. Figure J.1 shows the eight different ways in which a parallelogram tile of area 4 square centimeters can be cut out of a rectangular tile, subject to these restrictions. Figure J.1: The eight different ways for cutting a parallelogram of area 4. Youssef needs to cut tiles of every area between \(a_{lo}\) and \(a_{hi}\). Now he wonders, for which area \(a\) in this range can he cut the maximum number of different tiles?

제약
입력 형식

The input consists of multiple test cases. The first line of input contains an integer \(n\) (\(1 \le n \le 500\)), the number of test cases. The next \(n\) lines each contain two integers \(a_{lo}\), a_{hi} (\(1 \le a_{lo} \le a_{hi} \le 500\,000\)), the range of areas of the tiles.

출력 형식

For each test case \(a_{lo}\), \(a_{hi}\), display the value \(a\) between \(a_{lo}\) and \(a_{hi}\) such that the number of possible ways to cut a parallelogram of area \(a\) is maximized as well as the number of different ways \(w\) in which such a parallelogram can be cut. If there are multiple possible values of \(a\) display the smallest one.

예제 1
입력
2
4 4
2 6
출력
4 8
6 20
문제 정보

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

출처 ICPC World Finals 2015

평가 및 의견

J. Tile Cutting

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

Log in to rate problems.

개별 의견

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

풀이 제출

J. Tile Cutting

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