답안 #795704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
795704 2023-07-27T13:09:53 Z vjudge1 Team Contest (JOI22_team) C++17
0 / 100
1 ms 340 KB

// Author : حسن

#include <bits/stdc++.h>



using namespace std;

#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"


const int N = 3e5 + 9 , mod = 1e9 + 7;
ll c[N] = {} , d[N] = {} , a[N] = {}, b[N] = {}  , us[N] , dp[N] = {};


void solve(){
    ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
    cin>>n;
    vector<pair<int,int>>v[3];
    for(i = 1; i <= n; i++){
        cin>>a[i]>>b[i]>>c[i];
        v[0].pb({a[i] , i});
        v[1].pb({b[i] , i});
        v[2].pb({c[i] , i});
    }
    ll r[4] = {};
    r[0] = r[1] = r[2] = n - 1;
    sort(all(v[0]));
    sort(all(v[1]));
    sort(all(v[2]));
    while(r[0] >= 0 && r[1] >= 0 && r[2] >= 0){
        //cout<<v[0][r[0]].se<<" "<< v[1][r[1]].se<<" "<< v[2][r[2]].se<<"\n";
        if(b[v[0][r[0]].se] >= b[v[1][r[1]].se] || c[v[0][r[0]].se] >= c[v[2][r[2]].se]){
            r[0]--;
            continue;
        }
   if(r[0] >= 0 && r[1] >= 0 && r[2] >= 0)
        if(a[v[1][r[1]].se] >= a[v[0][r[0]].se] || c[v[1][r[1]].se] >= c[v[2][r[2]].se]){
            r[1]--;
           continue;
        }
        if(r[0] >= 0 && r[1] >= 0 && r[2] >= 0)
        if(a[v[2][r[2]].se] >= a[v[0][r[0]].se] || b[v[2][r[2]].se] >= b[v[1][r[1]].se]){
            r[2]--;
            continue;
        }
        cout<<v[0][r[0]].se<<" "<< v[1][r[1]].se<<" "<< v[2][r[2]].se<<"\n";
        cout<<v[0][r[0]].fi + v[1][r[1]].fi + v[2][r[2]].fi;
       return;
    //s++;
    //if(s >= 100)
    //break;
    }
    //cout<<s<<" ";
    //if(r[0] >= 0 && r[1] >= 0 && r[2] >=0)
    //      cout<<v[0][r[0]].fi + v[1][r[1]].fi + v[2][r[2]].fi;
    cout<<-1;
}

int main(){

     TL;
     /*
     #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
     #endif
     */
int t = 1;
//cin>>t;

while(t--)
     {
     solve();
     }

}
// Author : حسن

Compilation message

team.cpp: In function 'void solve()':
team.cpp:52:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   52 |    if(r[0] >= 0 && r[1] >= 0 && r[2] >= 0)
      |    ^~
team.cpp:57:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   57 |         if(r[0] >= 0 && r[1] >= 0 && r[2] >= 0)
      |         ^~
team.cpp:32:8: warning: unused variable 'q' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |        ^
team.cpp:32:16: warning: unused variable 'j' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                ^
team.cpp:32:20: warning: unused variable 'm' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                    ^
team.cpp:32:28: warning: unused variable 'z' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                            ^
team.cpp:32:32: warning: unused variable 's' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                                ^
team.cpp:32:40: warning: unused variable 'f' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                                        ^
team.cpp:32:43: warning: unused variable 'l' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                                           ^
team.cpp:32:48: warning: unused variable 'k' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                                                ^
team.cpp:32:52: warning: unused variable 'x' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                                                    ^
team.cpp:32:56: warning: unused variable 'y' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                                                        ^
team.cpp:32:60: warning: unused variable 'mn' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                                                            ^~
team.cpp:32:73: warning: unused variable 'mx' [-Wunused-variable]
   32 |     ll q , i , j , m , n , z , s  = 0, f, l ,  k , x , y , mn  = 1e18 , mx = 0;
      |                                                                         ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -