Submission #643381

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6433812022-09-21 23:32:06PajarajaTeam Contest (JOI22_team)C++17
8 / 100
2078 ms3460 KiB
#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];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

team.cpp: In function 'int main()':
team.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
team.cpp:19:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     for(int i=1;i<=n;i++) scanf("%d%d%d",&x[i],&y[i],&z[i]);
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...