# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
776834 | aZvezda | Team Contest (JOI22_team) | C++14 | 50 ms | 2508 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll MAX_N = 1e5 + 10;
ll n;
pair<ll, pair<int, int> > p[MAX_N];
deque<ll> down, up;
void put_down(ll ind) {
down.push_back(ind);
}
void put_up(ll ind) {
up.push_back(ind);
}
signed main() {
cin >> n;
for(ll i = 0; i < n; i ++) {
cin >> p[i].first >> p[i].second.first >> p[i].second.second;
}
sort(p, p + n);
ll ptr = 0;
ll ans = -1;
for(ll i = 0; i < n; i ++) {
while(ptr < i && p[ptr].first != p[i].first) {
put_down(ptr);
put_up(ptr);
ptr ++;
}
for(ll j = 0; j < down.size(); j ++) {
for(ll k = 0; k < up.size(); k ++) {
int indj = down[j];
int indk = down[k];
if(p[indj].second.first > p[indk].second.first && p[indj].second.second < p[indk].second.second) {
ans = max(ans, p[down[j]].second.first + p[up[k]].second.second + p[i].first);
}
}
}
}
cout << ans << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |