-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path랭킹전 대기열.py
More file actions
32 lines (27 loc) · 788 Bytes
/
랭킹전 대기열.py
File metadata and controls
32 lines (27 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
p, m = map(int, input().split())
room = [[] for _ in range(p)]
cnt = 0
level, name = input().split()
room[cnt].append((level, name))
cnt += 1
for _ in range(p - 1):
level, name = input().split()
flag = 0
for i in range(cnt):
if abs(int(room[i][0][0]) - int(level)) <= 10 and len(room[i]) < m:
room[i].append((level, name))
flag = 1
break
if flag == 0:
room[cnt].append((level, name))
cnt += 1
for i in range(cnt):
room[i].sort(key=lambda x: x[1])
if len(room[i]) == m:
print("Started!")
for j in range(len(room[i])):
print(*room[i][j])
else:
print("Waiting!")
for j in range(len(room[i])):
print(*room[i][j])