#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,i,x,y,z,t,s,j,k;
map<pair<ll,pair<ll,ll>>,ll> m;
pair<ll,pair<ll,ll>> a[3],p[110000];
int main()
{
scanf("%lld",&n);
for(i=1;i<=n;i++)
{
scanf("%lld %lld %lld",&x,&y,&z);
if(m[{x,{y,z}}]==1)
continue;
m[{x,{y,z}}]=1;
t++;
p[t]={x,{y,z}};
}
n=t;
for(i=1;i<=n;i++)
for(j=i+1;j<=n;j++)
for(k=j+1;k<=n;k++)
{
a[0]=p[i]; a[1]=p[j]; a[2]=p[k];
sort(a,a+3);
if(a[2].first==a[1].first)
continue;
if(a[1].second.first>a[0].second.first&&a[1].second.first>a[2].second.first)
{
if(a[0].second.second>a[1].second.second&&a[0].second.second>a[2].second.second)
{
s=max(s,a[2].first+a[0].second.second+a[1].second.first);
continue;
}
}
else if(a[0].second.first>a[1].second.first&&a[0].second.first>a[2].second.first)
{
if(a[1].second.second>a[0].second.second&&a[1].second.second>a[2].second.second)
{
s=max(s,a[1].second.second+a[0].second.first+a[2].first);
continue;
}
}
}
if(s==0)
s--;
printf("%lld",s);
}
Compilation message
team.cpp: In function 'int main()':
team.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
9 | scanf("%lld",&n);
| ~~~~~^~~~~~~~~~~
team.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
12 | scanf("%lld %lld %lld",&x,&y,&z);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
308 KB |
Output is correct |
9 |
Correct |
1 ms |
308 KB |
Output is correct |
10 |
Correct |
0 ms |
312 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
108 ms |
340 KB |
Output is correct |
15 |
Correct |
46 ms |
320 KB |
Output is correct |
16 |
Correct |
68 ms |
340 KB |
Output is correct |
17 |
Correct |
88 ms |
340 KB |
Output is correct |
18 |
Correct |
81 ms |
320 KB |
Output is correct |
19 |
Correct |
104 ms |
340 KB |
Output is correct |
20 |
Correct |
60 ms |
212 KB |
Output is correct |
21 |
Correct |
44 ms |
212 KB |
Output is correct |
22 |
Correct |
66 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
71 ms |
340 KB |
Output is correct |
25 |
Correct |
71 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
308 KB |
Output is correct |
9 |
Correct |
1 ms |
308 KB |
Output is correct |
10 |
Correct |
0 ms |
312 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
108 ms |
340 KB |
Output is correct |
15 |
Correct |
46 ms |
320 KB |
Output is correct |
16 |
Correct |
68 ms |
340 KB |
Output is correct |
17 |
Correct |
88 ms |
340 KB |
Output is correct |
18 |
Correct |
81 ms |
320 KB |
Output is correct |
19 |
Correct |
104 ms |
340 KB |
Output is correct |
20 |
Correct |
60 ms |
212 KB |
Output is correct |
21 |
Correct |
44 ms |
212 KB |
Output is correct |
22 |
Correct |
66 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
71 ms |
340 KB |
Output is correct |
25 |
Correct |
71 ms |
340 KB |
Output is correct |
26 |
Execution timed out |
2068 ms |
724 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
312 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
312 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
47 ms |
1180 KB |
Output is correct |
12 |
Correct |
30 ms |
844 KB |
Output is correct |
13 |
Correct |
27 ms |
1012 KB |
Output is correct |
14 |
Correct |
36 ms |
1052 KB |
Output is correct |
15 |
Correct |
32 ms |
1056 KB |
Output is correct |
16 |
Correct |
28 ms |
1168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
312 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
312 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
47 ms |
1180 KB |
Output is correct |
12 |
Correct |
30 ms |
844 KB |
Output is correct |
13 |
Correct |
27 ms |
1012 KB |
Output is correct |
14 |
Correct |
36 ms |
1052 KB |
Output is correct |
15 |
Correct |
32 ms |
1056 KB |
Output is correct |
16 |
Correct |
28 ms |
1168 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
55 ms |
312 KB |
Output is correct |
21 |
Execution timed out |
2087 ms |
468 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
312 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
312 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
47 ms |
1180 KB |
Output is correct |
12 |
Correct |
30 ms |
844 KB |
Output is correct |
13 |
Correct |
27 ms |
1012 KB |
Output is correct |
14 |
Correct |
36 ms |
1052 KB |
Output is correct |
15 |
Correct |
32 ms |
1056 KB |
Output is correct |
16 |
Correct |
28 ms |
1168 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
55 ms |
312 KB |
Output is correct |
21 |
Execution timed out |
2087 ms |
468 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
312 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
312 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
47 ms |
1180 KB |
Output is correct |
12 |
Correct |
30 ms |
844 KB |
Output is correct |
13 |
Correct |
27 ms |
1012 KB |
Output is correct |
14 |
Correct |
36 ms |
1052 KB |
Output is correct |
15 |
Correct |
32 ms |
1056 KB |
Output is correct |
16 |
Correct |
28 ms |
1168 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
55 ms |
312 KB |
Output is correct |
21 |
Execution timed out |
2087 ms |
468 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
308 KB |
Output is correct |
9 |
Correct |
1 ms |
308 KB |
Output is correct |
10 |
Correct |
0 ms |
312 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
108 ms |
340 KB |
Output is correct |
15 |
Correct |
46 ms |
320 KB |
Output is correct |
16 |
Correct |
68 ms |
340 KB |
Output is correct |
17 |
Correct |
88 ms |
340 KB |
Output is correct |
18 |
Correct |
81 ms |
320 KB |
Output is correct |
19 |
Correct |
104 ms |
340 KB |
Output is correct |
20 |
Correct |
60 ms |
212 KB |
Output is correct |
21 |
Correct |
44 ms |
212 KB |
Output is correct |
22 |
Correct |
66 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
71 ms |
340 KB |
Output is correct |
25 |
Correct |
71 ms |
340 KB |
Output is correct |
26 |
Execution timed out |
2068 ms |
724 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |