/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 36ms 1.02 MiB
#3 Wrong Answer 43ms 1.461 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()
{
   ll 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)
   {

      ll sum = n + m + k;
      cout << sum << 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());
      if (x == 1 and y == 1)
      {
         ll sum = 2 + s[0];
         cout << sum << el;
      }
      else
      {
         long long sum = x + y - 1 + s[0];
         cout << sum << 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>());
      if (v[0] != 1 and v[1] == 1 and v[2] == 1)
      {
         ll x = v[0] + 2;
         cout << x << el;
      }
      else
      {
         long long x = v[0] + v[1] - 1 + v[2] - 1;
         cout << x << el;
      }
   }
   else
   {
      long long x = 0;
      x = n + m + k;
      cout << x << 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:47:18
Judged At
2025-06-13 16:47:18
Judged By
Score
50
Total Time
43ms
Peak Memory
1.461 MiB