提出 #76690260


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() 
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tt;
    cin >> tt;
    while(tt--)
    {
        ll a, b, c, ans = 0;
        cin >> a >> b >> c;
        if(a == 0)
        {
            if(c >= b)
                ans = b;
            else
                ans = c - 1;
        }
        else if(b == 0)
        {
            if(a >= c)
                ans = c;
            else
                ans = a - 1;
        }
        else if(c == 0)
        {
            if(b >= a)
                ans = a;
            else
                ans = b - 1;
        }
        else
        {
            a--, b--, c--;
            for(int w = 0; w < 3; w++)
            {
                ans = max(ans, min(a + 1, b));
                ll x = min(a + 1, b);
                ll y = min(c, b - x);
                ans = max(ans, x + y);
                swap(a, b);
                swap(a, c);
            }
            ans = max(ans, min({a + b, b + c, c + a, (a + b + c) / 2}));
        }
        ans = max(ans, 0ll);
        cout << ans << '\n';
    }
    return 0;
}

提出情報

提出日時
問題 B - Circular RPS
ユーザ aaa65654
言語 C++23 (GCC 15.2.0)
得点 500
コード長 1196 Byte
結果 AC
実行時間 78 ms
メモリ 4780 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 1
AC × 19
セット名 テストケース
Sample 01_sample_01.txt
All 01_sample_01.txt, 02_small_01.txt, 02_small_02.txt, 02_small_03.txt, 02_small_04.txt, 02_small_05.txt, 02_small_06.txt, 02_small_07.txt, 02_small_08.txt, 03_rand_1_01.txt, 03_rand_1_02.txt, 03_rand_1_03.txt, 03_rand_1_04.txt, 03_rand_1_05.txt, 04_rand_2_01.txt, 04_rand_2_02.txt, 04_rand_2_03.txt, 04_rand_2_04.txt, 04_rand_2_05.txt
ケース名 結果 実行時間 メモリ
01_sample_01.txt AC 1 ms 3420 KiB
02_small_01.txt AC 56 ms 3544 KiB
02_small_02.txt AC 57 ms 3492 KiB
02_small_03.txt AC 57 ms 3492 KiB
02_small_04.txt AC 57 ms 3544 KiB
02_small_05.txt AC 56 ms 3420 KiB
02_small_06.txt AC 57 ms 3476 KiB
02_small_07.txt AC 56 ms 3528 KiB
02_small_08.txt AC 57 ms 3544 KiB
03_rand_1_01.txt AC 76 ms 4780 KiB
03_rand_1_02.txt AC 78 ms 4780 KiB
03_rand_1_03.txt AC 76 ms 4780 KiB
03_rand_1_04.txt AC 76 ms 4780 KiB
03_rand_1_05.txt AC 77 ms 4776 KiB
04_rand_2_01.txt AC 72 ms 3760 KiB
04_rand_2_02.txt AC 72 ms 3756 KiB
04_rand_2_03.txt AC 73 ms 3756 KiB
04_rand_2_04.txt AC 72 ms 3752 KiB
04_rand_2_05.txt AC 72 ms 3752 KiB