ABC238_D – AND and SUM
問題

D - AND and SUM
AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online.
提出

Submission #45055842 - Monoxer Programming Contest 2022(AtCoder Beginner Contest 238)
AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online.
3回目くらいで解けた
以下、解法を書く。
式変形の意図を書いてみる。
次に上記の式に
ここで、
つまり、
x_i | y_i | ||
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 0 or 1 | 1 or 0 |
1 | 0 | 1 | 1 |
1 | 1 | × | × |
両方
全てのビットを同時に計算することを考えると、
コメント