Submission #770280

#TimeUsernameProblemLanguageResultExecution timeMemory
770280PlurmTeam Contest (JOI22_team)C++11
37 / 100
2069 ms2692 KiB
#include <bits/stdc++.h>
using namespace std;

map<int, vector<pair<int, int>>> bckt;
int main() {
    int n;
    cin >> n;
    vector<int> keys;
    for (int i = 0; i < n; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        bckt[y].push_back({x, z});
        keys.push_back(y);
    }
    sort(keys.begin(), keys.end());
    keys.resize(unique(keys.begin(), keys.end()) - keys.begin());
    int mx = -1;
    for (int g : keys) {
        for (auto pti : bckt[g]) {
            int mxz = -1;
            for (int gg : keys) {
                for (auto ptk : bckt[gg]) {
                    if (ptk.first < pti.first) {
                        if (gg <= g)
                            mxz = max(mxz, ptk.second);
                    }
                }
            }
            for (int gg : keys) {
                if (gg <= g)
                    continue;
                for (auto ptj : bckt[gg]) {
                    if (pti.first > ptj.first) {
                        if (mxz > pti.second && mxz > ptj.second) {
                            mx = max(mx, pti.first + gg + mxz);
                        }
                    }
                }
                for (auto ptj : bckt[gg]) {
                    if (ptj.first < pti.first)
                        mxz = max(mxz, ptj.second);
                }
            }
        }
    }
    cout << mx << endl;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...