Untitled
unknown
plain_text
2 years ago
1.3 kB
3
Indexable
Never
#include <bits/stdc++.h> #define double long double using namespace std; const double eps = 1e-9; vector<vector<int>> v; int32_t main() { int k; cin >> k; for (int i = 0; i < k; i++) { int n; cin >> n; v.emplace_back(); for (int j = 0; j < n; j++) { int x; cin >> x; v[i].push_back(x); } } for (int i = 0; i < k; i++) { for (int j = i + 1; j < k; j++) { for (int l = j + 1; l < k; l++) { for (auto a : v[i]) { for (auto b : v[j]) { auto it = lower_bound(v[l].begin(), v[l].end(), max(a, b)); if (it != v[l].end() && a + b > *it) { cout << i + 1 << ' ' << a << ' ' << j + 1 << ' ' << b << ' ' << l + 1 << ' ' << *it; return 0; } if (it-- != v[l].begin() && min(a, b) + *it > max(a, b)) { cout << i + 1 << ' ' << a << ' ' << j + 1 << ' ' << b << ' ' << l + 1 << ' ' << *it; return 0; } } } } } } cout << -1; }