/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 328.0 KiB
#2 Accepted 39ms 1.105 MiB
#3 Wrong Answer 46ms 1.578 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define optimize()                   \
   ios_base::sync_with_stdio(false); \
   cin.tie(NULL); /*cout.tie(NULL);*/
#define fraction()               \
   cout.unsetf(ios::floatfield); \
   cout.precision(20);           \
   cout.setf(ios::fixed, ios::floatfield);
#define file()                       \
   freopen("input.txt", "r", stdin); \
   freopen("output", "w", stdout);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type,   less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int lcm(int a, int b) { return (a * b) / __gcd(a, b); }
int gcd(int a, int b) { return __gcd(a, b); }
typedef pair<int, int> pr;
typedef long long ll;
#define el "\n"
const int mod = 1e9 + 7;
const int mx = 1e5 + 125;

bool com(const pair<int, int> &p1, const pair<int, int> &p2)
{
   // if (p1.first == p2.first)
   // {
   //     return p1.second > p2.second;
   // }
   return p1.first < p2.first;
}

void giveanswer()
{
   int n,m,k;
   cin>>n>>m>>k;
   int f=0;
   if(n%2)f++;
   if(m%2)f++;
   if(k%2)f++;
   if(f==1)
   {
      cout<<n+m+k<<el;
   }
   else if(f==2)
   {
      vector<int>v,s;
      if(n%2)v.push_back(n);
      else s.push_back(n);
      if(m%2)v.push_back(m);
      else s.push_back(m);
      if(k%2)v.push_back(k);
      else s.push_back(k);
      int x=*max_element(v.begin(),v.end());
      int y=*min_element(v.begin(),v.end());
      cout<<x+y-1+s[0]<<el;

   }
   else if(f==3)
   {
      vector<int>v,s;
      if(n%2)v.push_back(n);
      else s.push_back(n);
      if(m%2)v.push_back(m);
      else s.push_back(m);
      if(k%2)v.push_back(k);
      else s.push_back(k);
      sort(v.begin(),v.end(),greater<int>());
      cout<<v[0]+v[1]-1+v[2]-1<<el;


   }
   else 
   {
      cout<<n+m+k<<el;
   }

   
   
}

int main()
{
   optimize();
   fraction();
   int t;
   cin >> t;
   while (t--)
   {
   giveanswer();
   }
}

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 16:32:38
Judged At
2025-06-13 16:32:38
Judged By
Score
50
Total Time
46ms
Peak Memory
1.578 MiB