/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 183ms 1.02 MiB
#3 Wrong Answer 216ms 1.434 MiB

Code

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+10;
#define int long long
#define Yes cout<<"YES"<<endl
#define No  cout<<"NO"<<endl
#define f first
#define s second
const int M = 1e9+7;
#define all(x) (x).begin(),(x).end()
#define setprecision(x) fixed<<setprecision((int)(x))
bool odd(int num) {return ((num & 1) == 1);}
bool even(int num) {return ((num & 1) == 0);}
const int inf = 1e18;
   


void solve(){
   int n,m,k;
    cin>>n>>m>>k;
    if((n+m+k)%2==0){
        cout<<n+m+k<<endl;
        return;
    }
    int odd = 0;
    if(n&1) odd++;
    if(m&1) odd++;
    if(k&1) odd++;
    if(odd==1){
        cout<<n+m+k<<endl;
    }else if(odd==2){
        int ans = 0;
        if(n%2==0){
            ans += n;
            ans += max(m,k);
            if(max(m,k)==m) ans += k - 1;
            else ans += m - 1;
        }else if(m%2==0){
            ans += m;
            ans += max(n,k);
            if(max(n,k)==n) ans += k - 1;
            else ans += n - 1;
        }else if(k%2==0){
            ans += k;
            ans += max(n,m);
            if(max(n,m)==n) ans += m - 1;
            else ans += n - 1;
        }
        cout<<ans<<endl;
    }else if(odd==3){
        int ans = 0;
        ans = max({n,m,k});
        if(ans==n){
            ans += m + k - 2;
        }else if(ans==m){
            ans += n + k - 2;
        }else if(ans==k){
            ans += n + m - 2;
        }
        cout<<ans<<endl;
    }
}



 
int32_t main(){ 
    ios::sync_with_stdio(0);cin.tie(0);
 
    //solve();



    int t;
    cin>>t;
    for(int T=1;T<=t;T++){
       //cout<<"Case "<<T<<": "; 
       solve();
    }
 
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1195 B. Palindrome
Contest
Brain Booster #10
Language
C++17 (G++ 13.2.0)
Submit At
2025-06-13 15:45:47
Judged At
2025-06-13 15:45:47
Judged By
Score
0
Total Time
216ms
Peak Memory
1.434 MiB