Editorial for Faceapp
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.
Spoiler Alert
Hint 1
- Duyệt qua từng ô \((i, j), (i + 1, j), (i, j + 1), (i + 1, j + 1) \forall (1 \leq i < n) và (1 \ leq j < m)\)
Kiểm tra xem 4 ô đõ có thỏa không
Hint 2
- Để kiểm tra nhanh, ta có thể sài hàm \(std::sort()\)
Nhận xâu \(t\) là giá trị của từng 4 ô kể trên sau sắp xêp
Nhận xâu \(pat\) là giá trị của xâu \(face\) sau sắp xếp
Khởi tạo biến đếm \(dem = 0\)
Với mỗi vị trí 4 ô, ta tăng biến đếm nếu xâu \(t\) = \(pat\)
Comments