답안 #955908

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
955908 2024-03-31T17:00:53 Z YassirSalama Team Contest (JOI22_team) C++17
8 / 100
2000 ms 11688 KB
#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
#define OVL(x,s) for(auto y:x) cout<<y<<s; cout<<"\n";
#ifdef IOI
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__);
#else
#define dbg(...) 1337;
#endif
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define ll long long
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define int long long
signed main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n;
cin>>n;
vector<vector<int>> v;
for(int i=0;i<n;i++){
    int a,b,c;
    cin>>a>>b>>c;
    v.pb({a,b,c});
}
int ans=0;
for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
        for(int k=j+1;k<n;k++){
            vector<int> a,b,c;
            a={v[i][0],v[j][0],v[k][0]};
            b={v[i][1],v[j][1],v[k][1]};
            c={v[i][2],v[j][2],v[k][2]};
            sort(all(a),greater<int>());
            sort(all(b),greater<int>());
            sort(all(c),greater<int>());
            if(a[0]==a[1]||b[0]==b[1]||c[0]==c[1]) continue;
            int x,y,z;
            set<int> s;
            vector<int> d={i,j,k};
            for(int jk=0;jk<3;jk++){
                if(v[d[jk]][0]==a[0]){
                    x=d[jk];
                    s.insert(x);
                    break;
                }
            }
            for(int jk=0;jk<3;jk++){
                if(v[d[jk]][1]==b[0]){
                    x=d[jk];
                    s.insert(x);
                    break;
                }
            }
            for(int jk=0;jk<3;jk++){
                if(v[d[jk]][2]==c[0]){
                    x=d[jk];
                    s.insert(x);
                    break;
                }
            }
            if(s.size()==3){
                ans=max(ans,a[0]+b[0]+c[0]);
            }

        }
    }
}
if(ans==0){
    cout<<-1<<endl;
    return 0;
}
cout<<ans<<endl;
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:42:19: warning: unused variable 'y' [-Wunused-variable]
   42 |             int x,y,z;
      |                   ^
team.cpp:42:21: warning: unused variable 'z' [-Wunused-variable]
   42 |             int x,y,z;
      |                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 360 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 452 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 727 ms 484 KB Output is correct
15 Correct 321 ms 348 KB Output is correct
16 Correct 496 ms 460 KB Output is correct
17 Correct 668 ms 488 KB Output is correct
18 Correct 576 ms 464 KB Output is correct
19 Correct 673 ms 460 KB Output is correct
20 Correct 568 ms 464 KB Output is correct
21 Correct 333 ms 468 KB Output is correct
22 Correct 489 ms 464 KB Output is correct
23 Correct 318 ms 468 KB Output is correct
24 Correct 575 ms 344 KB Output is correct
25 Correct 577 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 360 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 452 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 727 ms 484 KB Output is correct
15 Correct 321 ms 348 KB Output is correct
16 Correct 496 ms 460 KB Output is correct
17 Correct 668 ms 488 KB Output is correct
18 Correct 576 ms 464 KB Output is correct
19 Correct 673 ms 460 KB Output is correct
20 Correct 568 ms 464 KB Output is correct
21 Correct 333 ms 468 KB Output is correct
22 Correct 489 ms 464 KB Output is correct
23 Correct 318 ms 468 KB Output is correct
24 Correct 575 ms 344 KB Output is correct
25 Correct 577 ms 464 KB Output is correct
26 Execution timed out 2009 ms 600 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 448 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 2043 ms 11688 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 448 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 2043 ms 11688 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 448 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 2043 ms 11688 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 448 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 2043 ms 11688 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 360 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 452 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 727 ms 484 KB Output is correct
15 Correct 321 ms 348 KB Output is correct
16 Correct 496 ms 460 KB Output is correct
17 Correct 668 ms 488 KB Output is correct
18 Correct 576 ms 464 KB Output is correct
19 Correct 673 ms 460 KB Output is correct
20 Correct 568 ms 464 KB Output is correct
21 Correct 333 ms 468 KB Output is correct
22 Correct 489 ms 464 KB Output is correct
23 Correct 318 ms 468 KB Output is correct
24 Correct 575 ms 344 KB Output is correct
25 Correct 577 ms 464 KB Output is correct
26 Execution timed out 2009 ms 600 KB Time limit exceeded
27 Halted 0 ms 0 KB -