Editorial for Bedao Regular Contest 03 - WORDGAME
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Sử dụng ~1~ vòng lặp, tạo một xâu lưu trữ tạm thời chữ cái cuối của xâu vừa nhập vào sau đó so sánh với chữ cái đầu của xâu tiếp theo. Sử dụng map<string, long long> để kiểm tra xem xâu kí tự đã xuất hiện trước đó hay chưa.
Độ phức tạp: ~O(nlogn)~, có thể sử dụng unordered_map để có ~O(n)~
Comments
map truy xuất mất log(n) mà bài này chưa bị quá thời gian à