Submission #643381

# Submission time Handle Problem Language Result Execution time Memory
643381 2022-09-21T23:32:06 Z Pajaraja Team Contest (JOI22_team) C++17
8 / 100
2000 ms 3460 KB
#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];
            if(y[p[j]]>y[b[0]]) {swap(b[0],b[1]); b[0]=p[j];}
            else if(y[p[j]]>y[b[1]]) b[0]=p[j];
        }
    }
    for(int z=1;z<=n;z++) for(int k=1;k<=n;k++) for(int t=1;t<=n;t++) rez=max(rez,check(z,k,t));
    printf("%d\n",rez);
}

Compilation message

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 time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 132 ms 332 KB Output is correct
15 Correct 60 ms 320 KB Output is correct
16 Correct 89 ms 340 KB Output is correct
17 Correct 119 ms 340 KB Output is correct
18 Correct 107 ms 320 KB Output is correct
19 Correct 130 ms 320 KB Output is correct
20 Correct 121 ms 304 KB Output is correct
21 Correct 94 ms 340 KB Output is correct
22 Correct 102 ms 340 KB Output is correct
23 Correct 86 ms 332 KB Output is correct
24 Correct 87 ms 316 KB Output is correct
25 Correct 87 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 132 ms 332 KB Output is correct
15 Correct 60 ms 320 KB Output is correct
16 Correct 89 ms 340 KB Output is correct
17 Correct 119 ms 340 KB Output is correct
18 Correct 107 ms 320 KB Output is correct
19 Correct 130 ms 320 KB Output is correct
20 Correct 121 ms 304 KB Output is correct
21 Correct 94 ms 340 KB Output is correct
22 Correct 102 ms 340 KB Output is correct
23 Correct 86 ms 332 KB Output is correct
24 Correct 87 ms 316 KB Output is correct
25 Correct 87 ms 312 KB Output is correct
26 Execution timed out 2078 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 1 ms 212 KB Output is correct
3 Correct 0 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 408 KB Output is correct
6 Correct 0 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2073 ms 3460 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 408 KB Output is correct
6 Correct 0 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2073 ms 3460 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 408 KB Output is correct
6 Correct 0 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2073 ms 3460 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 408 KB Output is correct
6 Correct 0 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2073 ms 3460 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 132 ms 332 KB Output is correct
15 Correct 60 ms 320 KB Output is correct
16 Correct 89 ms 340 KB Output is correct
17 Correct 119 ms 340 KB Output is correct
18 Correct 107 ms 320 KB Output is correct
19 Correct 130 ms 320 KB Output is correct
20 Correct 121 ms 304 KB Output is correct
21 Correct 94 ms 340 KB Output is correct
22 Correct 102 ms 340 KB Output is correct
23 Correct 86 ms 332 KB Output is correct
24 Correct 87 ms 316 KB Output is correct
25 Correct 87 ms 312 KB Output is correct
26 Execution timed out 2078 ms 724 KB Time limit exceeded
27 Halted 0 ms 0 KB -