Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d67cd90

Browse files
Merge pull request #595 from JH-TT/BOJ_2539
모자이크
2 parents 04cc84e + d6e707b commit d67cd90

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

‎JongHo/BOJ/2539.py‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
def need(width):
5+
prev = -1
6+
ret = 0
7+
for pos in m_x:
8+
if prev == -1:
9+
prev = pos
10+
ret += 1
11+
elif prev + width <= pos:
12+
prev = pos
13+
ret += 1
14+
15+
return ret
16+
17+
r, c = map(int, input().split())
18+
n = int(input())
19+
mistake = int(input())
20+
21+
max_h = 0
22+
m_x = []
23+
24+
for _ in range(mistake):
25+
m_r, m_c = map(int, input().split())
26+
max_h = max(max_h, m_r)
27+
if m_c not in m_x:
28+
m_x.append(m_c)
29+
30+
m_x.sort()
31+
32+
start = max_h
33+
end = 1000000
34+
while start < end:
35+
m = (start + end) // 2
36+
if need(m) <= n:
37+
end = m
38+
else:
39+
start = m + 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /