답안 #545273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
545273 2022-04-04T06:43:29 Z leaked Team Contest (JOI22_team) C++14
8 / 100
2000 ms 10828 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pb push_back
#define sz(x) (int)(x).size()
#define pw(x) (1LL<<(x))
#define fast_resp ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef pair<int,ll> pil;
template<class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template<class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
const ll inf=1e18;
signed main(){
    fast_resp;
    int n;
    cin>>n;
    vec<vec<int>>a(n,vec<int>(3));
//    vec<int>mx(3);
    vec<vec<int>> kekw(3);
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j],kekw[j].pb(a[i][j]);
        }
    }
    for(int j=0;j<3;j++){
        sort(all(kekw[j]));
        kekw[j].erase(unique(all(kekw[j])),kekw[j].end());
        reverse(all(kekw[j]));
        kekw[j].resize(min(sz(kekw[j]),n));
    }
    auto check=[&](int x,int j){
//        if(x==kekw[j].back() || (sz(kekw[j])>1 && kekw[j][sz(kekw[j])-2]==x))
//            return 1;
        int ok=0;
        for(auto &z : kekw[j]) ok|=(z==x);
        return ok;
    };
    vec<int>ans;
    int mxt=-1;
//    for(i)
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(a[i][0]>max(a[j][0],a[k][0]) &&
                   a[j][1]>max(a[i][1],a[k][1]) &&
                   a[k][2]>max(a[i][2],a[j][2])){
                    if(check(a[i][0],0) || check(a[j][1],1) || check(a[k][2],2)){
                        umax(mxt,a[i][0]+a[j][1]+a[k][2]);
//                        ans={i,j,k};
                    }
                }
            }
        }
    }
    cout<<mxt;
//    if(mxt==-1){
//        cout<<-1;
//        return 0;
//    }
    return 0;
}
/*

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 232 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 336 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 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 288 ms 340 KB Output is correct
15 Correct 24 ms 336 KB Output is correct
16 Correct 57 ms 340 KB Output is correct
17 Correct 49 ms 340 KB Output is correct
18 Correct 120 ms 340 KB Output is correct
19 Correct 113 ms 340 KB Output is correct
20 Correct 52 ms 340 KB Output is correct
21 Correct 31 ms 340 KB Output is correct
22 Correct 38 ms 340 KB Output is correct
23 Correct 23 ms 340 KB Output is correct
24 Correct 30 ms 348 KB Output is correct
25 Correct 31 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 232 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 336 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 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 288 ms 340 KB Output is correct
15 Correct 24 ms 336 KB Output is correct
16 Correct 57 ms 340 KB Output is correct
17 Correct 49 ms 340 KB Output is correct
18 Correct 120 ms 340 KB Output is correct
19 Correct 113 ms 340 KB Output is correct
20 Correct 52 ms 340 KB Output is correct
21 Correct 31 ms 340 KB Output is correct
22 Correct 38 ms 340 KB Output is correct
23 Correct 23 ms 340 KB Output is correct
24 Correct 30 ms 348 KB Output is correct
25 Correct 31 ms 340 KB Output is correct
26 Execution timed out 2089 ms 596 KB Time limit exceeded
27 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 0 ms 280 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2066 ms 10828 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 0 ms 280 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2066 ms 10828 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 0 ms 280 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2066 ms 10828 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 0 ms 280 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Execution timed out 2066 ms 10828 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 232 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 336 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 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 288 ms 340 KB Output is correct
15 Correct 24 ms 336 KB Output is correct
16 Correct 57 ms 340 KB Output is correct
17 Correct 49 ms 340 KB Output is correct
18 Correct 120 ms 340 KB Output is correct
19 Correct 113 ms 340 KB Output is correct
20 Correct 52 ms 340 KB Output is correct
21 Correct 31 ms 340 KB Output is correct
22 Correct 38 ms 340 KB Output is correct
23 Correct 23 ms 340 KB Output is correct
24 Correct 30 ms 348 KB Output is correct
25 Correct 31 ms 340 KB Output is correct
26 Execution timed out 2089 ms 596 KB Time limit exceeded
27 Halted 0 ms 0 KB -