問題
長テーブルのうなぎ屋 (paizaランク B 相当)
https://paiza.jp/learning/long-table
解答
unagiya.py
def is_ocupied_seats(num, place):
for i in range(place, place+num):
if seats[i%n] == True:
return False
return True
n, m = map(int, input().split())
seats = [False] * n
for _ in range(m):
num, place = map(int, input().split())
place -= 1
if is_ocupied_seats(num, place):
seats[place:place+num] = [True]*num
# print(seats, is_ocupied_seats(num, place), place, num)
print(seats.count(True))