/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 22ms 572.0 KiB
#3 Wrong Answer 21ms 580.0 KiB
#4 Wrong Answer 22ms 576.0 KiB
#5 Wrong Answer 21ms 576.0 KiB
#6 Accepted 21ms 580.0 KiB
#7 Accepted 21ms 576.0 KiB
#8 Wrong Answer 21ms 588.0 KiB
#9 Wrong Answer 22ms 620.0 KiB
#10 Wrong Answer 21ms 620.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 

#define ll long long
#define int long long
template<typename s, typename t> void smax(s &a, const t &b) {if (a<b) a=b;}
template<typename s, typename t> void smin(s &a, const t &b) {if (a>b) a=b;}
char gap = 32;

#define rng_init mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rng_seed(x) mt19937 rng(x)
#define fill(x, y) memset(x, y, sizeof(x))
#define srt(v) sort(v.begin(), v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define pb push_back
#define lll __int128_t
ll hashPrime = 1610612741;

int solve(int a, int b, int c) {
    int mx = max({a, b, c});
    int A = (mx - a) % 2 == 0 ? (mx - a) / 2 : (mx - a) / 2 + 1;
    int B = (mx - b) % 2 == 0 ? (mx - b) / 2 : (mx - b) / 2 + 1;
    int C = (mx - c) % 2 == 0 ? (mx - c) / 2 : (mx - c) / 2 + 1;
    return max({A, B, C});
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; cin >> t;
    while(t--){
        int a, b, c;
        cin >> a >> b >> c;
        if (a == b && b == c) {
            cout << 0 << endl;
        } else {
            cout << solve(a, b, c) << endl;
        }
    }
}

Information

Submit By
Type
Submission
Problem
P1061 Bring equality
Contest
Brain Booster #4
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-14 17:53:49
Judged At
2024-10-03 13:35:42
Judged By
Score
30
Total Time
22ms
Peak Memory
620.0 KiB