Editorial for Bedao Mini Contest 17 - PLUS


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.

Author: bedao

Nếu biết được vị trí tâm và độ dài của 2 dấu cộng, ta có thể dễ dàng kiểm tra xem 2 dấu cộng đó có giao nhau không trong ~O(1)~. Từ đó, ta có thuật toán ~O(N^6)~ (~15^6~ xấp xỉ ~1e7~ vừa đủ time limit) là duyệt qua cặp tất cả các cặp vị trí là tâm của 2 dấu cộng, sau đó, với mỗi dấu cộng, ta xét tất cả các độ dài có thể của dấu cộng đó và tính tổng bằng Prefix Sum 2D.


Comments

Please read the guidelines before commenting.


There are no comments at the moment.