Submission #795115

# Submission time Handle Problem Language Result Execution time Memory
795115 2023-07-27T06:44:49 Z vjudge1 Team Contest (JOI22_team) C++14
17 / 100
2000 ms 2956 KB
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std ;
const int N = 15e4 ;
bool flag1, flag2 = 0 ;
int n, ans = -1, x[N + 1], y[N + 1], z[N + 1] ;
set<pair<int, pair<int, int>>> s ;
vector<pair<int, pair<int, int>>> v ;
int func(int i, int j, int q)
{
    if(x[i] > x[j] && x[i] > x[q] && y[j] > y[i] && y[j] > y[q] && z[i] < z[q] && z[j] < z[q])
        return x[i] + y[j] + z[q] ;
    else
        return -1 ;
}
int func1(int i, int j, int q)
{
    if(v[i].fi > v[j].fi && v[i].fi > v[q].fi && v[j].se.fi > v[i].se.fi && v[j].se.fi > v[q].se.fi && v[i].se.se < v[q].se.se && v[j].se.se < v[q].se.se)
        return v[i].fi + v[j].se.fi + v[q].se.se ;
    else
        return -1 ;
}
signed main()
{
    ios_base::sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
    cin >> n ;
    for(int i = 1 ; i <= n ; i++)
    {
        cin >> x[i] >> y[i] >> z[i] ;
        if(x[i] > 5 || y[i] > 5 || z[i] > 5)flag1 = 1 ;
        if(x[i] > 20 || y[i] > 20 || z[i] > 20)flag2 = 1 ;
        s.insert({x[i], {y[i], z[i]}}) ;
    }
    if(!flag2)
    {
        for(auto i : s)
            v.push_back(i) ;
        for(int i = 0 ; i < v.size() ; i++)
            for(int j = 0 ; j < v.size() ; j++)
            {
                if(i == j)
                    continue ;
                for(int q = 0 ; q < v.size() ; q++)
                {
                    if(i == q || q == j)
                        continue ;
                    ans = max(ans, func1(i, j, q)) ;
                }
            }
        cout << ans ;
        return 0 ;
    }
    if(n <= 300)
    {
        for(int i = 1 ; i <= n ; i++)
            for(int j = 1 ; j <= n ; j++)
            {
                if(i == j)
                    continue ;
                for(int q = 1 ; q <= n ; q++)
                {
                    if(j == q || i == q)
                        continue ;
                    ans = max(ans, func(i, j, q)) ;
                }
            }
        cout << ans << '\n' ;
        return 0 ;
    }
    if(n <= 4000)
    {
        cout << ans << '\n' ;
        return 0 ;
    }
    return 0 ;
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:41:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(int i = 0 ; i < v.size() ; i++)
      |                         ~~^~~~~~~~~~
team.cpp:42:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             for(int j = 0 ; j < v.size() ; j++)
      |                             ~~^~~~~~~~~~
team.cpp:46:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |                 for(int q = 0 ; q < v.size() ; q++)
      |                                 ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 260 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 106 ms 356 KB Output is correct
15 Correct 47 ms 344 KB Output is correct
16 Correct 71 ms 340 KB Output is correct
17 Correct 95 ms 356 KB Output is correct
18 Correct 84 ms 340 KB Output is correct
19 Correct 108 ms 348 KB Output is correct
20 Correct 44 ms 340 KB Output is correct
21 Correct 76 ms 364 KB Output is correct
22 Correct 75 ms 348 KB Output is correct
23 Correct 77 ms 340 KB Output is correct
24 Correct 78 ms 340 KB Output is correct
25 Correct 81 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 260 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 106 ms 356 KB Output is correct
15 Correct 47 ms 344 KB Output is correct
16 Correct 71 ms 340 KB Output is correct
17 Correct 95 ms 356 KB Output is correct
18 Correct 84 ms 340 KB Output is correct
19 Correct 108 ms 348 KB Output is correct
20 Correct 44 ms 340 KB Output is correct
21 Correct 76 ms 364 KB Output is correct
22 Correct 75 ms 348 KB Output is correct
23 Correct 77 ms 340 KB Output is correct
24 Correct 78 ms 340 KB Output is correct
25 Correct 81 ms 352 KB Output is correct
26 Incorrect 2 ms 724 KB Output isn't correct
27 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 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 33 ms 2912 KB Output is correct
12 Correct 16 ms 2068 KB Output is correct
13 Correct 18 ms 2432 KB Output is correct
14 Correct 24 ms 2956 KB Output is correct
15 Correct 21 ms 2892 KB Output is correct
16 Correct 21 ms 2892 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 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 33 ms 2912 KB Output is correct
12 Correct 16 ms 2068 KB Output is correct
13 Correct 18 ms 2432 KB Output is correct
14 Correct 24 ms 2956 KB Output is correct
15 Correct 21 ms 2892 KB Output is correct
16 Correct 21 ms 2892 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 44 ms 340 KB Output is correct
21 Execution timed out 2060 ms 468 KB Time limit exceeded
22 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 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 33 ms 2912 KB Output is correct
12 Correct 16 ms 2068 KB Output is correct
13 Correct 18 ms 2432 KB Output is correct
14 Correct 24 ms 2956 KB Output is correct
15 Correct 21 ms 2892 KB Output is correct
16 Correct 21 ms 2892 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 44 ms 340 KB Output is correct
21 Execution timed out 2060 ms 468 KB Time limit exceeded
22 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 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 33 ms 2912 KB Output is correct
12 Correct 16 ms 2068 KB Output is correct
13 Correct 18 ms 2432 KB Output is correct
14 Correct 24 ms 2956 KB Output is correct
15 Correct 21 ms 2892 KB Output is correct
16 Correct 21 ms 2892 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 44 ms 340 KB Output is correct
21 Execution timed out 2060 ms 468 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 260 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 106 ms 356 KB Output is correct
15 Correct 47 ms 344 KB Output is correct
16 Correct 71 ms 340 KB Output is correct
17 Correct 95 ms 356 KB Output is correct
18 Correct 84 ms 340 KB Output is correct
19 Correct 108 ms 348 KB Output is correct
20 Correct 44 ms 340 KB Output is correct
21 Correct 76 ms 364 KB Output is correct
22 Correct 75 ms 348 KB Output is correct
23 Correct 77 ms 340 KB Output is correct
24 Correct 78 ms 340 KB Output is correct
25 Correct 81 ms 352 KB Output is correct
26 Incorrect 2 ms 724 KB Output isn't correct
27 Halted 0 ms 0 KB -