Submission #955908

#TimeUsernameProblemLanguageResultExecution timeMemory
955908YassirSalamaTeam Contest (JOI22_team)C++17
8 / 100
2043 ms11688 KiB
#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 (stderr)

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;
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...