답안 #633452

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
633452 2022-08-22T13:40:48 Z Astrayt Team Contest (JOI22_team) C++17
0 / 100
2000 ms 14492 KB
//君の手を握ってしまったら
//孤独を知らないこの街には
//もう二度と帰ってくることはできないのでしょう
//君が手を差し伸べた 光で影が生まれる
//歌って聞かせて この話の続き
//連れて行って見たことない星まで
//さユリ - 花の塔
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pii pair<int,int>
#define pb push_back
#define ff first
#define ss second
#define N 100005

struct bev{
    int t, x, y, z;
};

void solve(){
    int n; cin >> n;
    vector<bev> v(n), buk[3];
    for(int i = 0; i < n; ++i){
        cin >> v[i].x >> v[i].y >> v[i].z; v[i].t = i;
        int k = max({v[i].x, v[i].y, v[i].z});
        if(k == v[i].x) buk[0].pb(v[i]);
        if(k == v[i].y) buk[1].pb(v[i]);
        if(k == v[i].z) buk[2].pb(v[i]);
    }
    sort(buk[0].begin(), buk[0].end(), [](bev a, bev b){return a.x > b.x;});
    sort(buk[1].begin(), buk[1].end(), [](bev a, bev b){return a.y > b.y;});
    sort(buk[2].begin(), buk[2].end(), [](bev a, bev b){return a.z > b.z;});
    int ans = -1;
    for(int i = 0; i < buk[0].size(); ++i){
        for(int j = 0; j < buk[1].size(); ++j){
            if(buk[0][i].t == buk[1][j].t) continue;
            bev b1 = buk[0][i], b2 = buk[1][j];
            if(b1.x <= b2.x || b2.y <= b1.y) continue;
            for(int k = 0; k < buk[2].size(); ++k){
                bev b3 = buk[2][k];
                if(b1.t == b3.t || b2.t == b3.t) continue;
                if(b1.x <= b3.x || b2.y <= b3.y) continue;
                if(b3.z <= max(b2.z, b1.z)) continue;
                ans = max(ans, b1.x + b2.y + b3.z);
            }
        }
    }
    cout << ans << '\n';
}

signed main(){
    starburst
    int t = 1; //cin >> t;
    while(t--) solve();
}

Compilation message

team.cpp: In function 'void solve()':
team.cpp:37:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<bev>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i = 0; i < buk[0].size(); ++i){
      |                    ~~^~~~~~~~~~~~~~~
team.cpp:38:26: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<bev>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(int j = 0; j < buk[1].size(); ++j){
      |                        ~~^~~~~~~~~~~~~~~
team.cpp:42:30: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<bev>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             for(int k = 0; k < buk[2].size(); ++k){
      |                            ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 320 KB Output is correct
15 Incorrect 1 ms 324 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 320 KB Output is correct
15 Incorrect 1 ms 324 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2082 ms 14492 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2082 ms 14492 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2082 ms 14492 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2082 ms 14492 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 320 KB Output is correct
15 Incorrect 1 ms 324 KB Output isn't correct
16 Halted 0 ms 0 KB -