|
| 1 | + |
| 2 | +#include <functional> |
| 3 | +#include <tuple> |
| 4 | +#include <cassert> |
| 5 | +#include <numeric> |
| 6 | +#include <iostream> |
| 7 | +#include <bitset> |
| 8 | +#include <cctype> |
| 9 | +#include <algorithm> |
| 10 | +#include <string> |
| 11 | +#include <vector> |
| 12 | +#include <cmath> |
| 13 | +#include <set> |
| 14 | +#include <string> |
| 15 | +#include <map> |
| 16 | +#include <stack> |
| 17 | +#include <cstdio> |
| 18 | +#include <cstring> |
| 19 | +#include <deque> |
| 20 | +#include <sstream> |
| 21 | +#include <queue> |
| 22 | +#include <climits> |
| 23 | +#include <complex> |
| 24 | +using namespace std; |
| 25 | + |
| 26 | +#define pb push_back |
| 27 | +#define pf push_front |
| 28 | +#define mp make_pair |
| 29 | +#define mt make_tuple |
| 30 | +#define INF 0x3f3f3f3f |
| 31 | +#define F first |
| 32 | +#define S second |
| 33 | +#define speedup ios_base::sync_with_stdio(0);cin.tie(0) |
| 34 | +#define all(c) c.begin(), c.end() |
| 35 | +#define rep(i, j, k) for (int i = (j); i < (int)(k); i++) |
| 36 | +#define rep2(i,j, f1,t1, f2,t2) for (int i = (f1); i < (int)(t1); i++) for (int j = (f2); j < (int)(t2); j++) |
| 37 | +#define Rep(i, j, k) for (int i = (j); i <= (int)(k); i++) |
| 38 | +#define Rep2(i,j, f1,t1, f2,t2) for (int i = (f1); i <= (int)(t1); i++) for (int j = (f2); j <= (int)(t2); j++) |
| 39 | +#define per(i, j, k) for (int i = (j); i >= (int)(k); i--) |
| 40 | +typedef long long LL; |
| 41 | +typedef long double LD; |
| 42 | +typedef pair<LL, LL> PLL; |
| 43 | +typedef pair<int, int> PII; |
| 44 | +typedef pair<LD, LD> PDD; |
| 45 | +typedef vector<LD> VD; |
| 46 | +typedef vector<PDD> VDD; |
| 47 | +typedef vector< vector<PDD> > VVD; |
| 48 | +typedef vector<LL> VL; |
| 49 | +typedef vector<PLL> VLL; |
| 50 | +typedef vector< vector<PLL> > VVL; |
| 51 | +typedef vector<int> VI; |
| 52 | +typedef vector<PII> VII; |
| 53 | +typedef vector<vector<PII> > VVI; |
| 54 | + |
| 55 | +bool in(LD &v) {return scanf("%Lf", &v)!=EOF;} |
| 56 | +bool in(LL &v) {return scanf("%lld", &v)!=EOF;} |
| 57 | +bool in(int &v) {return scanf("%d", &v)!=EOF;} |
| 58 | +bool in(char *v) {return scanf("%s", v)!=EOF;} |
| 59 | +bool in(char &v) {return scanf("%c", &v)!=EOF;} |
| 60 | +bool in(unsigned &v) {return scanf("%u", &v)!=EOF;} |
| 61 | +bool in(string &v) {return (bool)(cin >> v);} |
| 62 | +template<typename T, typename... Args> bool in(T &v, Args &...args) {bool ret = in(v); return ret && in(args...);} |
| 63 | + |
| 64 | +void out(LD v) {printf("%Lf", v);} |
| 65 | +void out(LL v) {printf("%lld", v);} |
| 66 | +void out(int v) {printf("%d", v);} |
| 67 | +void out(char v) {printf("%c", v);} |
| 68 | +void out(unsigned v) {printf("%u", v);} |
| 69 | +void out(string v) {printf("%s", v.c_str());} |
| 70 | +void out(const char *v) {printf("%s", v);} |
| 71 | +template<typename T> void out(vector<T> &v) {for (int i = 0; i < (int)v.size(); i++) out(v[i]);} |
| 72 | +template<typename T, typename ...Args> void out(T v, Args ...args) {out(v); out(args...);} |
| 73 | + |
| 74 | +int n; |
| 75 | +const int N = 1e5+5; |
| 76 | +LL a[N],b[N],c[N]; |
| 77 | +map<PLL,VLL> sp; |
| 78 | + |
| 79 | +#define MAXI(a,b) (a) = max((a), (b)) |
| 80 | +#define MINI(a,b) (a) = min((a), (b)) |
| 81 | + |
| 82 | +int main() { |
| 83 | + // freopen("d.in", "r", stdin); |
| 84 | + in(n); |
| 85 | + rep(i,0,n) { |
| 86 | + in(a[i],b[i],c[i]); |
| 87 | + LL t[] = {a[i],b[i],c[i]}; |
| 88 | + LL sum = a[i]+b[i]+c[i]; |
| 89 | + sort(t,t+3); |
| 90 | + rep2(k,j, 0,3, k+1,3) { |
| 91 | + sp[{t[k],t[j]}].pb({sum-t[k]-t[j], i}); |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + LL ans = 0; |
| 96 | + LL s1=-1, s2=-1; |
| 97 | + for (auto &it : sp) { |
| 98 | + vector<PLL> tt; |
| 99 | + set<LL> vis; |
| 100 | + for (auto it1 : it.S) { |
| 101 | + if (vis.find(it1.S) == vis.end()) { |
| 102 | + tt.pb(it1); |
| 103 | + vis.insert(it1.S); |
| 104 | + } |
| 105 | + } |
| 106 | + it.S = tt; |
| 107 | + sort(all(it.S), [](pair<LL,LL> a, pair<LL,LL> b) {return a.F > b.F;}); |
| 108 | + LL cur = min(it.F.F, it.F.S); |
| 109 | + LL ts1=-1, ts2=-1; |
| 110 | + if (it.S.size() >= 2) { |
| 111 | + MINI(cur, it.S[0].F+it.S[1].F); |
| 112 | + ts1 = it.S[0].S; ts2 = it.S[1].S; |
| 113 | + } |
| 114 | + else { |
| 115 | + MINI(cur, it.S[0].F); |
| 116 | + ts1 = it.S[0].S; ts2 = -1; |
| 117 | + } |
| 118 | + if (cur > ans) { |
| 119 | + s1 = ts1; s2 = ts2; |
| 120 | + ans = cur; |
| 121 | + } |
| 122 | + } |
| 123 | + |
| 124 | + if (s2 < 0) { |
| 125 | + out(1,'\n'); |
| 126 | + out(s1+1,'\n'); |
| 127 | + } |
| 128 | + else { |
| 129 | + out(2,'\n'); |
| 130 | + out(s1+1,' ',s2+1,'\n'); |
| 131 | + } |
| 132 | + |
| 133 | + return 0; |
| 134 | +} |
0 commit comments