我知道用map是不对,但是还是只有 30 pts,能帮忙看看吗?
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
struct FasterIO {
FasterIO() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
} ___IAKIOI___;
// The following is the real code.
// ===============================
map<pii, vector<int> > r1;
map<pii, vector<int> > id;
int getans(int x) {
return x * x * x / 4;
}
signed main() {
int n;
cin >> n;
int ans = 0, idx;
for (int i = 1; i <= n; i++) {
int a, b, c;
cin >> a >> b >> c;
if (a > b) swap(a, b);
if (a > c) swap(a, c);
if (b > c) swap(b, c);
r1[pii(b, c)].push_back(a);
id[pii(b, c)].push_back(i);
if (ans < a) {
ans = a;
idx = i;
}
}
int anshug = 0, idx1, idx2;
for (int i = 1; i <= 1000; i++) {
for (int j = 1; j <= 1000; j++) {
int fir = 0, firidx = 0;
for (int k = 0; k < r1[pii(i, j)].size(); k++) {
if (fir < r1[pii(i, j)][k]) {
fir = r1[pii(i, j)][k];
firidx = id[pii(i, j)][k];
}
}
int sec = 0, secidx = 0;
for (int k = 0; k < r1[pii(i, j)].size(); k++) {
if (sec < r1[pii(i, j)][k] && firidx != k) {
sec = r1[pii(i, j)][k];
secidx = k;
}
}
if (firidx && secidx && anshug < min(min(i, j), fir + sec)) {
anshug = min(min(i, j), fir + sec);
idx1 = firidx;
idx2 = secidx;
}
}
}
if (ans > anshug) {
cout << 0 << endl;
cout << idx << endl;
cout << getans(ans) << endl;
} else {
cout << 1 << endl;
cout << idx1 << " " << idx2 << endl;
cout << getans(anshug) << endl;
}
return 0;
}