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

S4. Tinted Glass Window

설명

You are laying \(N\) rectangular
pieces of grey-tinted glass to make a stained glass window. Each piece
of glass adds an integer value "tint-factor". Where two pieces of glass
overlap, the tint-factor is the sum of their tint-factors.

You know the desired position for each piece of glass and these
pieces of glass are placed such that the sides of each rectangle are
parallel to either the \(x\)-axis or
the \(y\)-axis (that is, there are no
"diagonal" pieces of glass).

You would like to know the total area of the finished stained glass
window with a tint-factor of at least \(T\).

제약
입력 형식

The first line of input is the integer \(N~(1 \leq N \leq 1000)\), the number of pieces of glass. The second line of
input is the integer \(T~(1 \leq T \leq 1\ 000\ 000 \ 000)\), the
threshold for the tint-factor. Each of the next \(N\) lines contain five integers,
representing the position of the top-left and bottom-right corners of
the \(i\)th piece of tinted glass
followed by the tint-factor of that piece of glass. Specifically, the
integers are placed in the order \(x_l\) \(y_t\) \(x_r\) \(y_b\) \(t_i\), where the top-left corner is at
\((x_l, y_t)\) and the bottom-right
corner is at \((x_r, y_b)\), and
tint-factor is \(t_i\). You can assume
that \(1 \leq t_i \leq 1\ 000\ 000\).
The top-most, left-most co-ordinate where glass can be placed is \((0,0)\) and you may assume \(0\leq x_l < x_r \leq K\) and \(0 < y_t < y_b \leq K\), and

The following additional constraints will apply.

  • At least 10% of the marks will be for test cases where \(N \leq 100\) and \(K \leq 100\);

  • at least 30% of the marks will be for test cases where \(N \leq 1000\) and \(K \leq 1000\);

  • at least 40% of the marks will be for test cases where \(N \leq 100\) and \(K \leq 1\ 000 \ 000\ 000\);

  • the remaining marks will be for test cases where \(N \leq 1000\) and \(K \leq 1\ 000 \ 000\ 000\).

출력 형식

Output the total area of the finished stained glass window which has
a tint-factor of at least \(T\). All
output will be less than \(2^{64}\),
and the output for some test cases will be larger than \(2^{32}\).

예제 1
입력
4
3
11 11 20 15 1
13 8 14 17 2
17 8 18 17 1
12 12 19 13 1
출력
5
설명

There are 4 pieces of glass used. There are two regions of glass
which have a tint-factor greater than or equal to 3: one region between
\((13, 11)\) and \((14, 15)\) (which has tint-factor of 3,
except for a unit square with tint-factor 4), and another region between
\((17,12)\) and \((18,13)\) (with tint-factor 3). In total,
these two regions have 5 square units of glass with tint-factor greater
than or equal to 3, as shown on the diagram below.

문제 정보

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

출처 CCC 2014 Senior

평가 및 의견

S4. Tinted Glass Window

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

Log in to rate problems.

개별 의견

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

풀이 제출

S4. Tinted Glass Window

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