& Omicron; (n 2). - . ++, , 0 1, :
typedef std::pair<int, int> xy;
typedef std::unordered_map<int, xy> sums;
template <int N>
xy func (const int (&a)[N]) {
sums s(2*N*N);
for (int lo = 0; lo < N-2; ++lo) {
for (int hi = lo+2; hi < N; ++hi) {
int ss = a[lo] + a[hi];
if (ss % 2 == 0) s[ss] = xy(lo, hi);
}
}
for (int i = 1; i < N-1; ++i) {
if (s.find(2*a[i]) != s.end()) return s[2*a[i]];
}
return xy(0, 0);
}
: & Omicron; (n 2).
, , , , x i (x j, x k). , (x j, x k) x i. , , , , .