A - Four Points Editorial by nok0
ユーザー解説です
排他的論理和を用いることで場合分けが不要になり、実装を簡略化することが可能です。
\(x,y\) それぞれについて入力の排他的論理和が答えと一致します。
同様のテクニックを以前の問題で解説していますので、詳しくは https://atcoder.jp/contests/abc236/editorial/3313 をご覧ください。
実装例 (C++):
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> x(3), y(3);
cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
cout << (x[0] ^ x[1] ^ x[2]) << " " << (y[0] ^ y[1] ^ y[2]) << endl;
return 0;
}
posted:
last update: