-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
name_table.add(log[1]) | ||
|
||
# 개강 총회가 끝나고 스트리밍 종료 전에 채팅을 남겼다면 출석부에서 이름 확인 후 제거 및 출석 인정 | ||
elif E <= time <= Q: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
54번째 라인과 55번째 라인의 조건문을 합치기
S,E,Q = input().split() | ||
|
||
# S,E,Q를 Datatime 객체로 변환 | ||
S = datetime.strptime(S, "%H:%M") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datetime.strptime() 함수를 lambda 함수를 통해 map으로 변환하기
if not log: | ||
break | ||
|
||
time = datetime.strptime(log[0], "%H:%M") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우열님 log[0]과 log[1]을 채팅 시간이랑 닉네임으로 명시적으로 써주면 좋을 것 같아요~!!
고생하셨습니다 👍👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 이전 문제 풀이에서 우열님의 datetime 활용이 떠올라 이번 문제를 우열님처럼 풀었지만, 이번 문제는 문자열 끼리 단순 비교해도 성립되도록 조건이 쉽게 주어졌기 때문에 문자열끼리 비교를 수행하는 편으로 하면 조금 더 효율적인 문제 해결이 가능했던 것 같습니다! 고생 많으셨습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 log[0], log[1] 의 변수명이 명시되어 있었으면 더 좋았겠다는 생각이 드네요!!
이외에 로직은 거의 똑같습니다!!
고생하셨습니다 우열님~!
PR Summary
싸이버개강총회
https://www.acmicpc.net/problem/19583
풀이시간
11:20 ~ 12:10 (50분)
문제 조건
(00:00 ≤ S < E < Q ≤ 23:59)
0 < 채팅 기록 < 10만
시간 복잡도 :
strptime은 N 길이의 문자열의 길이를 파싱할 때 O(N) - O(5)
O(100,000)
접근법
무슨 알고리즘으로 풀이 할 수 있을까? -> 해시 테이블
시간을 datetime 객체로 변환 후 조건의 시간들과 비교하여
출석부에 삽입 혹은 제거 연산을 시행하고 그 횟수를 남긴다.