# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
643381 | Pajaraja | Team Contest (JOI22_team) | C++17 | 2078 ms | 3460 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>
#define MAXN 200007
using namespace std;
map<pair<int,int>,bool> mp;
int p[MAXN],x[MAXN],y[MAXN],z[MAXN],a[2],b[2];
int check(int i,int j,int k)
{
if(i==j || i==k || j==k || i==0 || j==0) return -1;
if(x[i]<=x[j] || x[i]<=x[k]) return -1;
if(y[j]<=y[i] || y[j]<=y[k]) return -1;
if(z[k]<=z[i] || z[k]<=z[j]) return -1;
return x[i]+y[j]+z[k];
}
bool cmp(int i,int j) {return z[i]<z[j];}
int main()
{
int n,rez=-1;
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d%d%d",&x[i],&y[i],&z[i]);
for(int i=1;i<=n;i++) p[i]=i;
sort(p+1,p+n+1,cmp);
for(int i=1;i<=n;i++)
{
if(p[i]!=p[i-1]) for(int j=i-1;j>0;j--)
{
if(p[j]!=p[i-1]) break;
if(mp[{x[p[j]],y[p[j]]}]) continue;
mp[{x[p[j]],y[p[j]]}]=true;
if(x[p[j]]>x[a[0]]) {swap(a[0],a[1]); a[0]=p[j];}
else if(x[p[j]]>x[a[1]]) a[0]=p[j];
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... |