Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[맵과 셋] 03월 13일 #2

Merged
merged 2 commits into from
Mar 14, 2022
Merged

[맵과 셋] 03월 13일 #2

merged 2 commits into from
Mar 14, 2022

Conversation

Haewonny
Copy link
Member

내용 & 질문

2776번 자꾸 시간초과라고 뜨는데 해결방법을 모르겠습니다...!

<기존 제출>

2776, 9375, 11478, 19583, 20291, 20920

<추가 제출>

없음

Copy link
Member

@mkwkw mkwkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전체적으로 잘 풀어주셨습니다! 고생 많으셨어요~ 주석도 좋아요:) 5문제 통과로 과제 제출 확인되었습니다.

2776번에는 코멘트 작성하였습니다. 2776번은 해당 원소가 있는지만 체크하는 것이기 때문에 map보다는 set이나 vector에서 이분탐색을 이용하는 것이 좋아요~ 자세한 사항은 코멘트 확인해주세요!

2776번 수정해주시고 오른쪽 상단에 re-request review 버튼 눌러주세요~

}
m[name]++;
}
sort(file.begin(), file.end()); // 사전순으로 정렬
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p1. 이 코드는 어떤 이유로 작성하신건가요?

cout << "0\n";
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2. 이 문제에서는 map을 사용하지 않고 set을 사용하거나 vector의 이분탐색을 사용하는 것이 좋아요! set을 사용하려면 set 중에서도 unordered_set을 사용해야합니다. unordered_set은 시간복잡도가 O(1)이기 때문이에요. unordered_set과 find함수를 사용하면 시간초과 나지 않고 통과될 것입니다.
그리고 note[temp]는 사용하지 않는 것이 좋을 것 같아요! map에 없는 키가 들어가면 map에 자동으로 insert되기 때문이에요.

@Haewonny Haewonny requested a review from mkwkw March 13, 2022 16:19
Copy link
Member

@mkwkw mkwkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다~ 머지하셔도 됩니다!

@mkwkw
Copy link
Member

mkwkw commented Mar 14, 2022

선택 문제 6개 모두 제출하셔서 쿠폰도 1개 적립해드렸습니다~

@Haewonny Haewonny merged commit 346b6b4 into main Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants