When I was in a lecture, my students tried to troll me and asked the question that was banned from codeforces because of being NP hard. I did not know anything about that problem and I have tried to solve it. I struggled a lot but finally, I solved the problem in O($N*N$) complexity. I will not share my full solution because I do not want to give opportunities to people who will use this solution for bad ideas. I know you will not believe me but I will share some pictures while I was solving the problem. (It is up to you to believe...) (Also I do not believe that the world is a fair place, so I know I will not gain anything if I share my solution because I am a Turkish person and it is sad, but many of the population of the world do not love Turkish people.)↵
↵
![ ](https://userpic.codeforces.org/910511/title/c2f503d1b8816a55.jpg)↵
![ ](https://media.discordapp.net/attachments/810553531702444112/1073338512453144596/WhatsApp_Image_2023-02-09_at_23.23.08.jpeg?width=1256&height=565)↵
↵
**UPD:**↵
This is the zoomed version of original photo.↵
↵
![ ](https://userpic.codeforces.org/910511/title/ebf5f7eca9a88df0.jpg)↵
↵
![ ](https://userpic.codeforces.org/910511/title/c2f503d1b8816a55.jpg)↵
![ ](https://media.discordapp.net/attachments/810553531702444112/1073338512453144596/WhatsApp_Image_2023-02-09_at_23.23.08.jpeg?width=1256&height=565)↵
↵
**UPD:**↵
This is the zoomed version of original photo.↵
↵
![ ](https://userpic.codeforces.org/910511/title/ebf5f7eca9a88df0.jpg)↵