RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0374 파일 입출력

Mowing Mischief

Ruby IV 루비 IV
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Bessie's younger cousins, Ella and Bella, are visiting the farm. Unfortunately,
they have been causing nothing but mischief since they arrived.

In their latest scheme, they have decided to mow as much grass as they can. The
farm's prime grassland is in the shape of large \(T \times T\) square. The
bottom-left corner is \((0,0)\), and the top-right corner is \((T,T)\). The square
therefore contains \((T+1)^2\) lattice points (points with integer coordinates).

Ella and Bella plan to both start at \((0,0)\) and run at unit speed to \((T, T)\)
while each holding one end of a very sharp and very stretchy wire. Grass in any
area that is swept by this wire will be cut. Ella and Bella may take different
paths, but each path consists of only upward and rightward steps, moving from
lattice point to lattice point.

Bessie is rather concerned that too much grass will be cut, so she invents a
clever plan to constrain the paths Ella and Bella take. There are \(N\) yummy
flowers \((1 \leq N \leq 2 \cdot 10^5\)) scattered throughout the grassland, each
on a distinct lattice point. Bessie will pick a set of \(S\) flowers that will be
required for both Ella and Bella to visit (so Ella's path must visit all the
flowers in \(S\), and so must Bella's path). In order to add as many waypoints to
these paths as possible, Bessie will choose \(S\) to be as large as possible among
subsets of flowers that can be visited by a cow moving upward and rightward from
\((0,0)\) to \((T,T)\).

Ella and Bella will try to maximize the amount of grass they cut, subject to the
restriction of visiting flowers in \(S\). Please help Bessie choose \(S\) so that
the amount of grass cut is as small as possible.

Problem credits: Dhruv Rohatgi

제약

Problem credits: Dhruv Rohatgi

입력 형식

The first line contains \(N\) and \(T\) (\(1 \leq T \leq 10^6\)). Each of the next \(N\)
lines contains the integer coordinates \((x_i, y_i)\) of a flower. It is
guaranteed that \(1 \leq x_i, y_i \leq T-1\) for all \(i\), and no two flowers lie
on the same horizontal or vertical line.

In at least 20% of the test cases, it is further guaranteed that \(N \leq 3200\).

출력 형식

A single integer, giving the minimum possible amount of cut grass.

파일 입력 / 출력
이 문제는 표준 입출력을 사용하지 않습니다. 프로그램은 다음 파일을 읽고 써야 합니다:
입력을 읽을 파일 mowing.in
출력을 쓸 파일 mowing.out
예제 1
입력
5 20
19 1
2 6
9 15
10 3
13 11
출력
117
설명

In the above example, it is optimal for Bessie to pick the flowers at \((10,3)\)
and \((13,11)\). Then in the worst case, Ella and Bella will cut three rectangles
of grass with total area \(117\).

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2018-2019 > February > Platinum

태그

평가 및 의견

Mowing Mischief

개요
출제자 난이도 Ruby IV 루비 IV 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Mowing Mischief

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