wsaleem's blog

By wsaleem, 5 hours ago, In English

580948A - Tricky Template

We only need to check $$$a_i, b_i, c_i$$$ for each $$$1\le i\le n$$$. We guess $$$t_i$$$ based on $$$a_i$$$ and $$$b_i$$$. If, for any $$$i$$$, there is a mismatch between $$$c_i$$$ and $$$t_i$$$, the output is YES, otherwise, it is NO.

There are 2 cases, each with its subcases.

  • $$$a_i \ne b_i$$$
    • $$$t_i$$$ must be $$$X$$$ where $$$x \ne a_i$$$ and $$$x \ne b_i$$$. To mismatch, $$$c_i$$$ must be $$$x$$$, i.e. $$$c_i !\ne a_i$$$ and $$$c_i \ne b_i$$$
  • $$$a_i = b_i$$$
    • $$$t_i$$$ may be $$$X$$$ where $$$x \ne a_i$$$ and $$$x \ne b_i$$$. To mismatch, $$$c_i$$$ must be $$$x$$$, i.e. $$$c_i !\ne a_i$$$ and $$$c_i \ne b_i$$$
    • $$$t_i$$$ may be uppercase $$$A_i$$$ (note, $$$a_i=b_i$$$ in this case). To mismatch, $$$c_i$$$ must be different from lowercase $$$a_i$$$, i.e. $$$c_i !\ne a_i$$$ and $$$c_i \ne b_i$$$.

In all cases, for $$$c_i$$$ to mismatch, it must be that $$$c_i !\ne a_i$$$ and $$$c_i \ne b_i$$$.

Original problem: 1922A - Tricky Template, leads to official tutorial and all solutions including WS solution: 300910838

  • Vote: I like it
  • -1
  • Vote: I do not like it